背景
试图用干净的安装Apache Maven的3.1.0的Java库添加到本地Maven仓库,与Java 1.7。下面是如何加入的Java归档文件:项目的POM缺失,没有依赖资料
mvn install:install-file \
-DgroupId=net.sourceforge.ant4x \
-DartifactId=ant4x \
-Dversion=0.3.0 \
-Dfile=ant4x-0.3.0.jar \
-Dpackaging=jar
此创建以下目录结构:
$HOME/.m2/repository/net/sourceforge/ant4x/
├── 0.3.0
│ ├── ant4x-0.3.0.jar.lastUpdated
│ └── ant4x-0.3.0.pom.lastUpdated
└── ant4x
├── 0.3.0
│ ├── ant4x-0.3.0.jar
│ ├── ant4x-0.3.0.pom
│ └── _remote.repositories
└── maven-metadata-local.xml
该项目的pom.xml
文件引用了相关项目(上面的树)如下:
<properties>
<java-version>1.5</java-version>
<net.sourceforge.ant4x-version>0.3.0</net.sourceforge.ant4x-version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
...
<dependency>
<groupId>net.sourceforge</groupId>
<artifactId>ant4x</artifactId>
<version>${net.sourceforge.ant4x-version}</version>
<scope>provided</scope>
</dependency>
问题
运行后mvn compile
,返回下列错误(full log on Pastebin):
[ERROR] Failed to execute goal on project ant4docbook: Could not resolve dependencies for project net.sourceforge:ant4docbook:jar:0.6-SNAPSHOT: Failure to find net.sourceforge:ant4x:jar:0.3.0 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]
的documentation音符一系列可能出现的问题,但是,没有这些看起来适用。
想法
我尝试以下,按照文档:
- 复制默认设置用户的主目录的Maven:
cp /opt/apache-maven-3.1.0/conf/settings.xml $HOME/.m2/.
- 编辑用户的settings.xml文件。
- 更新本地存储库的值:
${user.home}/.m2/repository
- 保存该文件。
我也尝试下面的命令:
mvn -U
mvn clear -U
我使用Maven 3.0.5尝试过,但失败了。
问题
你如何强制Maven来使用这个库的本地版本,而不是试图去寻找一个库,尚未提供下载?
相关
未解决该问题相关的问题和信息:
- The POM for org.springframework.security:org.springframework.security.web:jar:3.0.5.RELEASE is missing, no dependency information available
- How can I locate the POM which requests a missing POM?
- Maven: Including jar not found in public repository
- http://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html
- http://giallone.blogspot.ca/2012/12/maven-install-missing-offline.html
我找不到任何这样的工件注册与maven。我尝试添加这个我的mavne,但它仍然无法工作。例外:缺少神器net.sourceforge.ant4x:ant4x:jar:0.3.0:提供。你确定? – gyan
这是因为Maven试图在中央repo(可在互联网上)或本地repo(在pom配置文件中配置)中找到任何jar。在这个地方的以太网上,这个jar应该在那里,或者可以使用** maven:install **命令来安装它。 – gyan