![maven install plugin 2.4 maven install plugin 2.4](https://www.medianic.co.uk/wp-content/uploads/2017/08/design-1210160_1280-1024x682.jpg)
Now, let's verify it by calling our /welcome endpoint: Our Spring Boot application is up and running. Next, let's start our application and check if it works: $ java -jar target/spring-boot-artifacts-2.jar For example, an embedded tomcat library is packaged into the BOOT-INF/lib directory. Here, in the repackaged JAR file, we have not only the compiled Java classes from our project but also all the runtime libraries that are needed to start our Spring Boot application. If we check the output above, it's much longer than the JAR file built by the mvn package command. META-INF/maven/-boot-modules/spring-boot-artifacts-2/pom.propertiesīOOT-INF/lib/spring-boot-starter-web-2.3.3.RELEASE.jarīOOT-INF/lib/spring-boot-starter-tomcat-2.3.3.RELEASE.jarīOOT-INF/lib/tomcat-embed-core-9.0.37.jarīOOT-INF/lib/tomcat-embed-websocket-9.0.37.jarīOOT-INF/lib/spring-web-5.2.8.RELEASE.jar META-INF/maven/-boot-modules/spring-boot-artifacts-2/pom.xml Org/springframework/boot/loader/JarLauncher.classīOOT-INF/classes/com/baeldung/demo/DemoApplication.classīOOT-INF/classes/com/baeldung/demo/DemoRestController.class
![maven install plugin 2.4 maven install plugin 2.4](https://static.admfactory.com/images/logos/maven.jpg)
![maven install plugin 2.4 maven install plugin 2.4](https://i0.wp.com/programmingtechie.com/wp-content/uploads/2020/12/Intellij-Install-Plugin.png)
Let's check the content of the repackaged JAR file: $ jar tf target/spring-boot-artifacts-2.jar Now, if we check the target directory, we'll see the repackaged JAR file and the original JAR file: $ ls -1 target/*jar*
MAVEN INSTALL PLUGIN 2.4 ARCHIVE
Replacing main artifact with repackaged archive Building jar: /home/kent/./target/spring-boot-artifacts-2.jar Therefore, we need to first build the JAR file before executing the spring-boot:repackage goal: $ mvn clean package spring-boot:repackage This is because the spring-boot:repackage goal takes the existing JAR or WAR archive as the source and repackages all the project runtime dependencies inside the final artifact together with project classes. In this way, the repackaged artifact is executable using the command line java -jar JAR_FILE.jar. :spring-boot-maven-plugin:2.3.3.RELEASE:repackage failed: Source file must not be null -> On project spring-boot-artifacts-2: Execution default-cli of goal Failed to execute goal :spring-boot-maven-plugin:2.3.3.RELEASE:repackage (default-cli) spring-boot-maven-plugin:2.3.3.RELEASE:repackage (default-cli) spring-boot-artifacts-2. Let's check the content of the created JAR file: $ jar tf target/spring-boot-artifacts-2.jarĬom/baeldung/demo/DemoRestController.classĪs we can see in the output above, the JAR file created by the mvn package command contains only the resources and compiled Java classes from our project's source. Īfter executing the mvn package command, we can find the built JAR file spring-boot-artifacts-2.jar under the target directory. maven-jar-plugin:2.4:jar (default-jar) spring-boot-artifacts-2. Building spring-boot-artifacts-2 1.0.0-SNAPSHOT
MAVEN INSTALL PLUGIN 2.4 CODE
Maven's package goal will take the compiled code and package it in its distributable format, which in this case is the JAR format: $ mvn package
![maven install plugin 2.4 maven install plugin 2.4](https://imgs.developpaper.com/imgs/1561523-20200114163444498-1760021667.png)
We only need the spring-boot-starter-web dependency to build our Spring Boot application: spring-boot-artifacts-2