19

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>
oberlies
  • 11,503
  • 4
  • 63
  • 110
dev
  • 271
  • 1
  • 3
  • 11

2 Answers2

26

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.

oberlies
  • 11,503
  • 4
  • 63
  • 110
  • 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 : org.eclipse.tycho target-platform-configuration ${tycho-version} net.sf.logsaw parent 1.0.0-SNAPSHOT workspace – dev Jul 15 '13 at 06:42
  • 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 ? – dev Jul 15 '13 at 07:07
  • @ritesh The sonatype blog you linked is outdated in many aspects. E.g. `-Dtcho.targetPlatform` is deprecated. – oberlies Jul 15 '13 at 07:19
  • @dev Follow-up questions are discouraged on stackoverflow. Check if your question is already answered elsewhere, or ask a new question. – oberlies Jul 15 '13 at 07:21
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.

yu yang Jian
  • 6,680
  • 7
  • 55
  • 80