"Unknown packaging: eclipse-plugin" in Maven

dev picture dev · Jul 14, 2013 · Viewed 17.7k times · Source

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>

Answer

oberlies picture oberlies · Jul 14, 2013

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.