"Unknown packaging: eclipse-plugin" in Maven
Asked Answered
S

2

20

I want to build a project in Maven using eclipse-plugin packaging, but I get the following error for my POM:

[ERROR] Unknown packaging: eclipse-plugin @ line 15, column 13 .

pom.xml:

<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>

  <parent> 
    <relativePath>../releng/pom.xml</relativePath>
    <groupId>net.sf.logsaw</groupId>
    <artifactId>parent</artifactId>
    <version>1.0.0-SNAPSHOT</version>
  </parent> 

  <artifactId>net.sf.logsaw.core</artifactId>
  <version>1.0.4-SNAPSHOT</version>
  <packaging>eclipse-plugin</packaging> 

  <name>LogSaw Core Plugin</name> 
</project>
Servomechanism answered 14/7, 2013 at 11:56 Comment(3)
please share the code...Haste
<project xmlns="maven.apache.org/POM/4.0.0" xmlns:xsi="w3.org/2001/XMLSchema-instance" xsi:schemaLocation="maven.apache.org/POM/4.0.0 maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <relativePath>../releng/pom.xml</relativePath> <groupId>net.sf.logsaw</groupId> <artifactId>parent</artifactId> <version>1.0.0-SNAPSHOT</version> </parent> <artifactId>net.sf.logsaw.core</artifactId> <version>1.0.4-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> <name>LogSaw Core Plugin</name> </project>Servomechanism
@ritesh: This comment was not helpful. All relevant information is present in the original question.Improper
I
27

The packaging type eclipse-plugin is defined by a Maven build extension called Tycho. In order to use Tycho's packaging types, you need to configure Tycho as a build extension:

<build>
  <plugins>
    <plugin>
      <groupId>org.eclipse.tycho</groupId>
      <artifactId>tycho-maven-plugin</artifactId>
      <version>${tycho-version}</version>
      <extensions>true</extensions>
    </plugin>
  </plugins>
</build>

Also, Tycho requires additional metadata files to be present, e.g. an OSGi manifest for eclipse-plugin modules. Another major difference of a Tycho project compared to a regular Maven project is that you have to configure the so-called target platform, e.g. by defining a repository with layout=p2, in case your project references any external artifacts. To get started, you may have a look at this example project.

For more information, you can also check out Tycho's documentation wiki, e.g. the reference card page.

Improper answered 14/7, 2013 at 12:31 Comment(4)
Now I get the following error: org.apache.maven.InternalErrorException: Internal error: java.lang.RuntimeException: Could not resolve target platform specification artifact net.sf.logsaw:parent:target:workspace:1.0.0-SNAPSHOT and here is part of my pom : <plugin> <groupId>org.eclipse.tycho</groupId> <artifactId>target-platform-configuration</artifactId> <version>${tycho-version}</version> <configuration> <target> <artifact> <groupId>net.sf.logsaw</groupId> <artifactId>parent</artifactId> <version>1.0.0-SNAPSHOT</version> <classifier>workspace</classifier> </artifact> </target>Servomechanism
and when i comment the target element i get this error : Missing requirement: net.sf.logsaw.core 1.0.0.qualifier requires 'bundle org.eclipse.core.runtime 0.0.0' but it could not be found. Any idea plz ?Servomechanism
@Haste The sonatype blog you linked is outdated in many aspects. E.g. -Dtcho.targetPlatform is deprecated.Improper
@Servomechanism Follow-up questions are discouraged on stackoverflow. Check if your question is already answered elsewhere, or ask a new question.Improper
E
0

In my case, I find a project folder has pom.xml with <packaging>eclipse-plugin</packaging> , the project cannot import to eclipse,

after go to upper root level folder, the root folder pom.xml has <groupId>org.eclipse.tycho</groupId>, this root folder can import to eclipse, all child projects shows successfully.

Expecting answered 30/6, 2023 at 12:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.