Search code examples
eclipsemavenm2eclipsejenkins

Eclipse Indigo + me2 project import: Unknown packaging / could not find artifact


Note: I'm just getting started with Jenkins plugin development and have never used maven before.

I have successfully set up a sample plugin with maven and the command line. (HelloWorldBuilder is building and running correctly via mvn hpi:run.)

I have then installed eclipse (indigo) and the m2e plugin and tried to import the maven project into eclipse. (Via Import > Existing Maven Projects)

The project is imported, but it displays two errors:

@pom.xml, line 1 :

<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/maven-v4_0_0.xsd">

Project build error: Unresolveable build extension: Plugin org.jenkins- ci.tools:maven-hpi-plugin:1.72 or one of its dependencies could not be resolved: Could not find artifact com.sun:tools:jar:1.5 at specified path C:\Programme\Java\jre6/../lib/tools.jar

@pom.xml, line 12 :

<packaging>hpi</packaging>

Project build error: Unknown packaging: hpi

Any ideas?

  • I have already changed the m2e setting (Window > Preferences > Maven > Installations) for the maven installation to use my maven 2.1.1 that I use on the command line.
  • I have also tried Right-Click-Project > Maven > Update-Dependencies... / Update-Project-Configuration / and Enable-Workspace-Resolution (whatever these settings mean)
  • This question seems to describe a similar problem, but I have no clue whether it's a duplicate.

Solution

  • I think your Eclipse installation runs under a Java JRE instead of a Java JDK, this is why the tools jar could not be found.

    M2Eclipse normally warns the user about that fact at first startup.

    The solution is to specify the jdk executable in the eclipse.ini file like shown below.

    add:

    -vm
    C:/Program Files (x86)/Java/jdk1.6.0_26/bin/javaw.exe
    

    before the line starting with -vmargs