views:

921

answers:

3

I use the latest m2eclipse to generate a standard ejb project, but then I got an error:

Missing artifact javaee:javaee-api:jar:5:provided

The pom.xml is as follow:

<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"&gt;
    <modelVersion>4.0.0</modelVersion>
    <groupId>IMS-LEXXWAR</groupId>
    <artifactId>ims.base.ejb</artifactId>
    <packaging>ejb</packaging>
    <version>1.0.0</version>
    <name>ims.base.ejb JEE5 EJB</name>
    <url>http://maven.apache.org&lt;/url&gt;
    <dependencies>

        <dependency>
            <groupId>javaee</groupId>
            <artifactId>javaee-api</artifactId>
            <version>5</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>

    </dependencies>

    <repositories>
        <repository>
            <id>java.net1</id>
            <name>Java.Net Maven1 Repository, hosts the javaee-api dependency</name>
            <url>http://download.java.net/maven/1&lt;/url&gt;
            <layout>legacy</layout>
        </repository>
    </repositories>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.0.2</version>
                <configuration>
                    <source>1.5</source>
                    <target>1.5</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-ejb-plugin</artifactId>
                <version>2.1</version>
                <configuration>
                    <ejbVersion>3.0</ejbVersion>
                </configuration>
            </plugin>

        </plugins>
        <finalName>ims.base.ejb</finalName>
    </build>
</project>

What's wrong?

A: 

You don't have the artifact installed in the local repository and maven cannot find it in the repositories it knows about either.

The name for javaee.javaee-api looks formal enough but mvnrepository.com does not know anything about it. If it is a jar which you have locally (why would it be called javaee though?), you need to install it in the local mvn repository using the mvn install command (the exact command used for installing is usually provided with that error you've been seeing).

laura
But if I go using browser to here: http://download.java.net/maven/1 The artifact is indeed there.
nanda
Then download the jar and install it locally.
laura
+2  A: 

I ended up using this:

<dependency>
    <groupId>org.apache.openejb</groupId>
    <artifactId>javaee-api</artifactId>
    <version>5.0-2</version>
    <type>jar</type>
    <scope>provided</scope>
</dependency>
nanda
+1  A: 

This is a weird problem as things are working fine on my machine (c). With the the following repository definition:

  <repositories>
    <repository>
      <id>java-net-m1-repository</id>
      <name>Java.net Maven 1.x Repository</name>
      <url>http://download.java.net/maven/1&lt;/url&gt;
      <layout>legacy</layout>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </repository>
  </repositories>

And this dependency:

  <dependencies>
    <dependency>
      <groupId>javaee</groupId>
      <artifactId>javaee-api</artifactId>
      <version>5</version>
      <scope>provided</scope>
    </dependency>
  </dependencies>

The artifact gets downloaded by m2eclipse/maven without problems:

1/19/10 3:09:48 PM CET: Downloading java-net-m1-repository : javaee/poms/javaee-api-5.pom
1/19/10 3:09:48 PM CET: Downloaded [java-net-m1-repository] -> http://download.java.net/maven/1/javaee/poms/javaee-api-5.pom
1/19/10 3:09:49 PM CET: Downloading java-net-m1-repository : javaee/jars/javaee-api-5.jar
1/19/10 3:09:52 PM CET: Downloaded [java-net-m1-repository] -> http://download.java.net/maven/1/javaee/jars/javaee-api-5.jar

So I actually don't know what is happening exactly.

To debug it, I'd first switch to the command line. In your case, I'd start by checking the URL from which the artifact is getting downloaded (this should be printed in the console, using the -X option shouldn't be necessary) and try to mimic this download with something like wget.

If you don't find anything obvious, then check the effective POM that you can obtain using the following command:

mvn help:effective-pom

It's hard to point you in a special direction without more details but I would take a look at it (could it be a proxy problem?).

Another idea would be to try to reproduce this problem on another machine/configuration and, if it works, check the differences.

As I said, this should just work. But without a way to reproduce and/or more information, debugging this problem feels like walking in the dark :)

Pascal Thivent
Nope it is still not working. I don't know what else to provide. The only error I can see is: 19.01.10 15:39:02 MEZ: [WARN] Missing artifact metadata for javaee:javaee-api:jar:519.01.10 15:39:04 MEZ: Maven Builder: AUTO_BUILD 19.01.10 15:39:35 MEZ: Missing artifact javaee:javaee-api:jar:5:provided
nanda
That's weird, very weird. Are you behind a proxy?
Pascal Thivent