I have a maven parent in which I have defined 1 module for the plugin.
The parent pom looks like this:
<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.angle</groupId>
<artifactId>angle-eclipse</artifactId>
<version>1.0.0</version>
<packaging>pom</packaging>
<modules>
<module>../com.angle.ui</module>
</modules>
<properties>
<java.version>1.8</java.version>
<tycho-version>1.0.0</tycho-version>
<oxygen-repo.url>http://download.eclipse.org/releases/oxygen</oxygen-repo.url>
<goal.preset>clean install</goal.preset>
</properties>
<repositories>
<repository>
<id>oxygen</id>
<layout>p2</layout>
<url>${oxygen-repo.url}</url>
</repository>
</repositories>
<build>
<!-- <defaultGoal>${goal.preset}</defaultGoal> -->
<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-maven-plugin</artifactId>
<version>${tycho-version}</version>
<extensions>true</extensions>
</plugin>
</plugins>
</pluginManagement>
</build>
The module is a plugin whose nature I have converted to Maven.
The pom.xml of the module looks like this:
<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>
<name>com.angle.ui</name>
<description>UI part of the plug-in</description>
<parent>
<groupId>com.angle</groupId>
<artifactId>angle-eclipse</artifactId>
<version>1.0.0</version>
<relativePath>../angle-eclipse</relativePath>
</parent>
<artifactId>com.angle.ui</artifactId>
<packaging>eclipse-plugin</packaging>
Now, even though I have added the tycho-maven-plugin as a build plugin, it is giving me the error: Project build error: Unknown packaging: eclipse-plugin and I am not able to build the maven project.
No other errors are there.
I searched other posts also but there the only solution they have given is to include the tycho-maven-plugin as build plugin in the parent pom, and this method is not resolving the issue for me.
Please help me with this.
I was able to solve my issue by changing the parent pom.xml
to the below code:
<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.angle</groupId>
<artifactId>angle-eclipse</artifactId>
<version>1.0.0</version>
<packaging>pom</packaging>
<modules>
<module>../com.angle.ui</module>
</modules>
<properties>
<java.version>1.8</java.version>
<tycho-version>1.0.0</tycho-version>
<oxygen-repo.url>http://download.eclipse.org/releases/oxygen</oxygen-repo.url>
<goal.preset>clean install</goal.preset>
</properties>
<repositories>
<repository>
<id>oxygen</id>
<layout>p2</layout>
<url>${oxygen-repo.url}</url>
</repository>
</repositories>
<build>
<!-- <defaultGoal>${goal.preset}</defaultGoal> -->
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-maven-plugin</artifactId>
<version>${tycho-version}</version>
<extensions>true</extensions>
</plugin>
</plugins>
</build>
The crucial difference is that the <extension>
needs to below project/build/plugins
rather than project/build/pluginManagement/plugins
. Managed plugins won’t be effective unless referenced elsewhere; hence, the build extension is not enabled and the eclipse-plugin
packaging is not registered.