Posts

Showing posts with the label maven

maven-jar-plugin

<plugin> <!-- Build an executable JAR --> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <version>3.1.0</version> <configuration> <archive> <manifest> <!-- <addClasspath>true</addClasspath>--> <!-- <classpathPrefix>lib/</classpathPrefix>--> <mainClass>main.Application</mainClass> </manifest> </archive> </configuration> </plugin> Nếu bạn có một file .jar hoặc .war và dùng câu lệnh java -jar app.jar mà không thực thi được chương trình thì khi đó bạn cần add plugin bên trên vào file pom.xml và build lại toàn bộ suorce code. Lúc này trình maven sẽ chỉ rõ fil...

maven-compiler-plugin

<build> <plugins> <plugin> <groupId> org.apache.maven.plugins </groupId> <artifactId> maven-compiler-plugin </artifactId> <version> 3.8.0 </version> <configuration> <source> 9 </source> <target> 9 </target> </configuration> </plugin> </plugins> </build> Khi bạn tạo một Maven project để thực hiện được các lệnh như mvn clean : dùng để xóa toàn bộ các file java.class và làm sạch thư mục target khi build mvn compile : dùng để compile toàn bộ file .java trong ứng dụng thành file .class mvn install : dùng để build toàn bộ tập file .class thành .jar hoặc .war thành file có thể thực thi được --------------- trong file trên chúng ta để ý tới version 3.0.8 đây chỉ là version của plugin, nó giống như version của app của bạn vậy source 9: nghĩa là code của ...