1

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.

Arjun Panicker
  • 730
  • 1
  • 8
  • 20
  • Possible duplicate of ["Unknown packaging: eclipse-plugin" in Maven](https://stackoverflow.com/questions/17639162/unknown-packaging-eclipse-plugin-in-maven) – Stultuske Jan 10 '18 at 06:51
  • @Stultuske it is not a duplicate. As mentioned in my question, I have tried that approach and it is not working. – Arjun Panicker Jan 10 '18 at 06:55
  • how much of that approach have you tried? – Stultuske Jan 10 '18 at 06:58
  • I have tried adding the plugin of tycho-maven-plugin. – Arjun Panicker Jan 10 '18 at 07:01
  • "the approach" suggested is a wee bit more than just that. if you only implement 25% of the suggested solution, there's indeed a chance it won't work – Stultuske Jan 10 '18 at 07:02
  • Okay.. Can you please point out as to what I have missed? I have been struggling a lot with this error and I am new to tycho. – Arjun Panicker Jan 10 '18 at 07:08
  • never used it myself. but the comments add suggestions, and they even point to other pages you could take a look at – Stultuske Jan 10 '18 at 07:11
  • Did you tried to specify the Tycho plugin also in the module `pom.xml` (in addition to the parent `pom.xml`)? See for example https://git.eclipse.org/c/jdt/eclipse.jdt.core.git/tree/pom.xml – howlger Jan 10 '18 at 07:33
  • @howlger yes, I did try that method. It did not help.. It gave the same error. – Arjun Panicker Jan 10 '18 at 08:20

1 Answers1

0

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.

Andreas Sewe
  • 1,558
  • 9
  • 18
Arjun Panicker
  • 730
  • 1
  • 8
  • 20
  • But by this method, I am getting the following error: `Plugin execution not covered by lifecycle configuration: org.eclipse.tycho:tycho-compiler-plugin:1.0.0:compile (execution: default-compile, phase: compile)` While using the quick fix for this issue, I got the above code and all the errors were resolved. – Arjun Panicker Jan 11 '18 at 04:59
  • Yes, but the `Plugin execution not covered by lifecycle configuration` has nothing to do with the `Project build error: Unknown packaging: eclipse-plugin` error the question is about. Hence, I removed the part of your solution that was **not** relevant to your original question. But of course, you should still add the lifecycle mapping **if** you are using m2e. – Andreas Sewe Jan 11 '18 at 10:34
  • Okay. I understand now. Thank you – Arjun Panicker Jan 11 '18 at 11:37