我尝试添加非托管依赖项,如此处所述:https://devcenter.heroku.com/articles/local-maven-dependencies。
但它只适用于Windows,而不适用于Linux。
项目结构
|- src
|- main
|- java
|- ...
|- resources
|- libs
|- net
|- milkbowl
|- Vault
|- vault
|- maven-metadata.xml
|- ...
|- 1.2.26-SNAPSHOT
|- vault-1.2.26-SNAPSHOT.jar
|- vault-1.2.26-SNAPSHOT.pom
|- ...
|- pom.xml
我的POM:
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<packaging>pom</packaging>
[...]
<repositories>
<repository>
<id>bukkit-repo</id>
<url>http://repo.bukkit.org/content/repositories/snapshots/</url>
</repository>
<repository>
<id>local-dependencies</id>
<url>file:${project.basedir}/../libs/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.7.5-R0.1-SNAPSHOT</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>net.milkbowl.vault</groupId>
<artifactId>vault</artifactId>
<version>1.2.26-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
[...]
</project>
错误:缺少神器net.milkbowl.vault:vault:jar:1.2.26-SNAPSHOT
答案 0 :(得分:0)
首先获取jar,然后执行以下maven目标,将该jar安装到本地存储库
mvn install:install-file -Dfile=/path/to/vault.jar -DgroupId=net.milkbowl.vault
-DartifactId=vault -Dversion=1.2.26-SNAPSHOT -Dpackaging=jar
如果这是SUCCESSFUL
,则在主项目上再次执行构建,其中定义为依赖
答案 1 :(得分:0)
我的猜测是问题的根源是jar的命名。在版本中有SNAPSHOT告诉maven在存储库中查找最新的快照。为什么不从名称中删除SNAPSHOT,并试试。