Maven now successfully builds the PAR for your application. However, the dependecies of the PAR
are not apparent. In this step the Maven dependency
plugin is added to
collect the transitive dependency graph for the PAR.
In the <build><plugins>…</plugins></build>
section (after the par
plugin
declaration), add a plugin declaration for the dependency
plugin.
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <executions> <execution> <id>copy-dependencies</id> <phase>package</phase> <goals> <goal>copy-dependencies</goal> </goals> <configuration> <outputDirectory>${project.build.directory}/par-provided</outputDirectory> <overWriteIfNewer>true</overWriteIfNewer> <excludeGroupIds>com.springsource.dmserver</excludeGroupIds> </configuration> </execution> </executions> </plugin>
Run the following command.
mvn clean package
When the command has completed, it will have copied all of the PAR’s dependencies into the
target/par-provided
directory.
The output from Maven should include lines like these (these lines are wrapped for this document):
[INFO] [dependency:copy-dependencies {execution: copy-dependencies}] [INFO] Copying com.springsource.javax.persistence-1.0.0.jar to /opt/greenpages-1.0.0.BUILD/start/greenpages/target/par-provided/com.springsource.javax.persistence-1.0.0.jar [INFO] Copying com.springsource.org.apache.commons.dbcp-1.2.2.osgi.jar to /opt/greenpages-1.0.0.BUILD/start/greenpages/target/par-provided/com.springsource.org.apache.commons.dbcp-1.2.2.osgi.jar [INFO] Copying com.springsource.org.apache.commons.pool-1.3.0.jar to /opt/greenpages-1.0.0.BUILD/start/greenpages/target/par-provided/com.springsource.org.apache.commons.pool-1.3.0.jar [INFO] Copying com.springsource.org.apache.log4j-1.2.15.jar to /opt/greenpages-1.0.0.BUILD/start/greenpages/target/par-provided/com.springsource.org.apache.log4j-1.2.15.jar [INFO] Copying com.springsource.org.eclipse.persistence-1.0.0.jar to /opt/greenpages-1.0.0.BUILD/start/greenpages/target/par-provided/com.springsource.org.eclipse.persistence-1.0.0.jar [INFO] Copying com.springsource.org.eclipse.persistence.antlr-1.0.0.jar to /opt/greenpages-1.0.0.BUILD/start/greenpages/target/par-provided/com.springsource.org.eclipse.persistence.antlr-1.0.0.jar [INFO] Copying com.springsource.org.eclipse.persistence.asm-1.0.0.jar to /opt/greenpages-1.0.0.BUILD/start/greenpages/target/par-provided/com.springsource.org.eclipse.persistence.asm-1.0.0.jar [INFO] Copying com.springsource.org.eclipse.persistence.jpa-1.0.0.jar to /opt/greenpages-1.0.0.BUILD/start/greenpages/target/par-provided/com.springsource.org.eclipse.persistence.jpa-1.0.0.jar [INFO] Copying com.springsource.freemarker-2.3.12.jar to /opt/greenpages-1.0.0.BUILD/start/greenpages/target/par-provided/com.springsource.freemarker-2.3.12.jar
If the dependencies are produced, proceed to the next step.