java - 项目的 POM 丢失,没有可用的依赖信息

背景

尝试使用全新安装的 Apache Maven 3.1.0 和 Java 1.7 将 Java 库添加到本地 Maven 存储库。以下是 Java 归档文件的添加方式:

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注意到一些可能存在的问题,但这些问题似乎都不适用。

想法

根据文档,我尝试了以下方法:

  1. 将默认设置复制到用户的 Maven 主目录:
    cp /opt/apache-maven-3.1.0/conf/settings.xml $HOME/.m2/.
  2. Edit the user's settings.xml file.
  3. Update the value for the local repository:
    ${user.home}/.m2/repository
  4. Save the file.

I also tried the following commands:

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

最佳答案

变化:

<!-- ANT4X -->
<dependency>
  <groupId>net.sourceforge</groupId>
  <artifactId>ant4x</artifactId>
  <version>${net.sourceforge.ant4x-version}</version>
  <scope>provided</scope>
</dependency>

收件人:

<!-- ANT4X -->
<dependency>
  <groupId>net.sourceforge.ant4x</groupId>
  <artifactId>ant4x</artifactId>
  <version>${net.sourceforge.ant4x-version}</version>
  <scope>provided</scope>
</dependency>

net.sourceforgegroupId 不正确。正确的值是 net.sourceforge.ant4x

https://stackoverflow.com/questions/18732175/

相关文章:

xcode4 - Xcode 自定义构建配置导致静态库出现 "library/file not fo

c - 开始使用自动工具

android-studio - 将 Android Studio 升级到 3.4 后无法连接 ad

ios - Xcode 可以构建项目但不能在模拟器上运行

makefile - 为什么我被警告项目没有使用 "CMAKE_TOOLCHAIN_FILE"变量?

javascript - 在 javascript eslint 中允许使用分号

visual-studio - 如何使用 CMake 和 Visual Studio 设置路径环境变

windows - 执行 : "gcc": executable file not found in

Xcode - 如何查看构建命令和日志?

java - 使用 Maven 从文件名中删除版本号