javaee-api 的 Maven

发布于 2024-08-18 00:26:40 字数 2643 浏览 6 评论 0原文

我使用最新的m2eclipse生成一个标准的ejb项目,但随后出现错误:

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

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

出了什么问题?

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">
    <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</url>
    <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</url>
            <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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

々眼睛长脚气 2024-08-25 00:26:40

我最终使用了这个:

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

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>
私藏温柔 2024-08-25 00:26:40

这是一个奇怪的问题,因为在我的机器上一切正常(c)。使用以下存储库定义:

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

以及此依赖项:

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

m2eclipse/maven 毫无问题地下载工件:

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

所以我实际上不知道到底发生了什么。

为了调试它,我首先切换到命令行。对于您的情况,我首先检查下载工件的 URL(此应该打印在控制台中,不应该使用 -X 选项是必要的)并尝试使用 wget 之类的东西来模拟此下载。

如果你没有发现任何明显的东西,那么检查你可以使用以下命令获得的有效 POM:

mvn help:effective-pom

如果没有更多细节,很难为你指出一个特殊的方向,但我会看一下它(可能是代理问题) ?)。

另一个想法是尝试在另一台机器/配置上重现此问题,如果有效,请检查差异。

正如我所说,这应该可行。但是如果没有办法重现和/或更多信息,调试这个问题就像在黑暗中行走:)

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</url>
      <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 :)

橪书 2024-08-25 00:26:40

您没有在本地存储库中安装该工件,并且 maven 也无法在它所知道的存储库中找到它。

javaee.javaee-api 的名称看起来足够正式,但 mvnrepository.com 对此一无所知。如果它是您本地的 jar(为什么它会被称为 javaee?),您需要使用 mvn install 命令将其安装在本地 mvn 存储库中(用于安装的确切命令是通常会提供您所看到的错误)。

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文