javaee-api 的 Maven
我使用最新的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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我最终使用了这个:
I ended up using this:
这是一个奇怪的问题,因为在我的机器上一切正常(c)。使用以下存储库定义:
以及此依赖项:
m2eclipse/maven 毫无问题地下载工件:
所以我实际上不知道到底发生了什么。
为了调试它,我首先切换到命令行。对于您的情况,我首先检查下载工件的 URL(此应该打印在控制台中,不应该使用
-X
选项是必要的)并尝试使用 wget 之类的东西来模拟此下载。如果你没有发现任何明显的东西,那么检查你可以使用以下命令获得的有效 POM:
如果没有更多细节,很难为你指出一个特殊的方向,但我会看一下它(可能是代理问题) ?)。
另一个想法是尝试在另一台机器/配置上重现此问题,如果有效,请检查差异。
正如我所说,这应该可行。但是如果没有办法重现和/或更多信息,调试这个问题就像在黑暗中行走:)
This is a weird problem as things are working fine on my machine (c). With the the following repository definition:
And this dependency:
The artifact gets downloaded by m2eclipse/maven without problems:
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:
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 :)
您没有在本地存储库中安装该工件,并且 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).