gpt4 book ai didi

java - Maven:如何在 Linux 上使用非托管依赖项?

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:09:25 25 4
gpt4 key购买 nike

我尝试添加非托管依赖项,如下所述: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>

错误: 缺少 Artifact net.milkbowl.vault:vault:jar:1.2.26-SNAPSHOT

最佳答案

首先获取 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,那么在你的主项目上再次执行构建,它被定义为依赖

关于java - Maven:如何在 Linux 上使用非托管依赖项?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22969361/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com