It's common for the parent and child projects to be located outside the workspace; for historical reasons, Eclipse doesn't deal well with nested projects in the workspace. It's also common for the parent project to host all of the Tycho configuration information, which makes setting up the child projects a lot easier.
com.packtpub.e4.parent
.pom.xml
in the root of the project.com.packtpub.e4.clock.ui
plug-in's pom.xml
file to the parent, but change the artifactId
to com.packtpub.e4.parent
and the packaging
to pom
.properties
element in the pom.xml
file and inside a tycho.version
element with the value 0.25.0
, as well as an eclipse
element with the value http://download.eclipse.org/releases/neon/.0.25.0
in the existing Tycho plugin
and replace it with ${tycho.version}
.http://download.eclipse.org/releases/neon/
in the existing repositories url
and replace it with ${eclipse}
.com.packtpub.e4.clock.ui
plug-in underneath the parent project.modules
element to the pom.xml
file and underneath a module
element with the value com.packtpub.e4.clock.ui
.pom.xml
file should look like:<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.packtpub.e4</groupId> <artifactId>com.packtpub.e4.parent</artifactId> <version>1.0.0-SNAPSHOT</version> <packaging>pom</packaging> <properties> <tycho.version>0.25.0</tycho.version><eclipse>http://download.eclipse.org/releases/neon/</eclipse> </properties> <modules> <module>com.packtpub.e4.clock.ui</module> </modules> <build> <plugins> <plugin> <groupId>org.eclipse.tycho</groupId> <artifactId>tycho-maven-plugin</artifactId> <version>${tycho.version}</version> <extensions>true</extensions> </plugin> </plugins> </build> <repositories> <repository> <id>eclipse</id> <layout>p2</layout> <url>${eclipse}</url> </repository> </repositories> </project>
com.packtpub.e4.clock.ui/pom.xml
file and add a parent
element with a groupId
, artifactId
, and version
that are the same as the parent. It is possible to remove the version
and groupId
from the child pom.xml
file, as it will default to the parent's groupId
and version
if not specified:<parent> <groupId>com.packtpub.e4</groupId> <artifactId>com.packtpub.e4.parent</artifactId> <version>1.0.0-SNAPSHOT</version> </parent>
plugins
and repositories
elements from the pom.xml
file in the com.packtpub.e4.clock.ui
project.mvn clean package
. The parent will be built, and in turn build all the modules in the list:[INFO] Reactor Summary: [INFO] [INFO] com.packtpub.e4.parent ............ SUCCESS [0.049s] [INFO] com.packtpub.e4.clock.ui .......... SUCCESS [1.866s] [INFO] [INFO] BUILD SUCCESS
Each plug-in is its own Eclipse project, and therefore its own Maven project. To build a set of projects together, there needs to be a parent POM, which acts as an aggregator.
At build time, Maven calculates the order in which projects need to be built, and then arranges the build steps appropriately.
The other benefit provided by a parent pom.xml
file is the ability to specify standard build plug-ins and configuration information. In this case, the parent specifies the link with Tycho and its versions. This simplifies the implementation of the other plug-ins and features that lie underneath the parent project.
13.59.61.119