Thorsten Maus (see Section A.2, “Documentation”) has developed a Maven plugin that builds a PAR file from a list of dependencies. In this step
the Maven par
plugin is added to properly build a PAR artifact type.
Add a <pluginRepository/>
declaration to the greenpages
POM file so that Maven can find the
par
plugin:
<pluginRepositories> <pluginRepository> <id>steademy</id> <name>Steademy repository</name> <url>http://repo.steademy.com/beta/maven2</url> </pluginRepository> </pluginRepositories>
In the <build><plugins>…</plugins></build>
section, add a plugin declaration for the
par
plugin.
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-par-plugin</artifactId> <version>0.2.0</version> <configuration> <fqn>true</fqn> <applicationSymbolicName>greenpages</applicationSymbolicName> <applicationVersion>${project.version}</applicationVersion> <applicationDescription>GreenPages PAR</applicationDescription> <applicationName>GreenPages PAR</applicationName> </configuration> </plugin>
Declare the list of bundles to be packaged in the PAR as dependencies of the PAR project.
<dependency> <groupId>com.springsource.dmserver</groupId> <artifactId>greenpages.app</artifactId> <version>${project.version}</version> </dependency> <dependency> <groupId>com.springsource.dmserver</groupId> <artifactId>greenpages.jpa</artifactId> <version>${project.version}</version> </dependency> <dependency> <groupId>com.springsource.dmserver</groupId> <artifactId>greenpages.db</artifactId> <version>${project.version}</version> </dependency> <dependency> <groupId>com.springsource.dmserver</groupId> <artifactId>greenpages.web</artifactId> <version>${project.version}</version> </dependency>
Run the following command.
mvn clean package
This command will now complete successfully and build a PAR into target/
. Proceed to
the next step.
[INFO] [par:par] [INFO] assembling artifacts for par package [INFO] greenpages [INFO] artifact greenpages.app is copied with fully qualified name com.springsource.dmserver.greenpages.app-1.0.0.SNAPSHOT [INFO] artifact greenpages.jpa is copied with fully qualified name com.springsource.dmserver.greenpages.jpa-1.0.0.SNAPSHOT [INFO] artifact greenpages.db is copied with fully qualified name com.springsource.dmserver.greenpages.db-1.0.0.SNAPSHOT [INFO] artifact greenpages.web is copied with fully qualified name com.springsource.dmserver.greenpages.web-1.0.0.SNAPSHOT [INFO] added com.springsource.dmserver.greenpages.app-1.0.0.SNAPSHOT.jar [INFO] added com.springsource.dmserver.greenpages.db-1.0.0.SNAPSHOT.jar [INFO] added com.springsource.dmserver.greenpages.jpa-1.0.0.SNAPSHOT.jar [INFO] added com.springsource.dmserver.greenpages.web-1.0.0.SNAPSHOT.jar