将内容更改为Maven依赖项

问题描述 投票:0回答:1

我当前正在更改docker映像。泊坞窗映像创建一个服务器,该服务器允许运行一些实验。为了适应其功能,我必须更改依赖项jar文件中包含的类。在pom.xml文件中,从jar存储库下载了此类jar依赖项及其依赖项。我认为一个可能的解决方案是在nexus存储库(localhost)中创建一个存储库,然后上传jar文件及其依赖项,对吗?无论如何,我都不知道该怎么做。以下是与此有关的代码。有人可以帮我吗?

<repositories>
    <repository>
        <id>ossrh</id>
        <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
        <releases>
            <enabled>false</enabled>
        </releases>
    </repository>
</repositories>

<dependencies>
    <dependency>
        <groupId>org.liveontologies</groupId>
        <artifactId>pinpointing-experiments</artifactId>
        <version>${project.version}</version>       
        </dependency>
</dependencies>

<distributionManagement>
    <snapshotRepository>
        <id>ossrh</id>
        <url>https://oss.sonatype.org/content/repositories/snapshots</url>
    </snapshotRepository>
</distributionManagement>
java maven docker nexus
1个回答
0
投票

是的,您在正确的轨道上。您要问的是在Maven中称为“部署”。因此,通常要部署jar,您需要:

  1. 创建您的关系实例
  2. 将新的存储库添加到pom文件中
  3. maven-deploy-plugin添加到您的pom中
  4. 进行代码更改
  5. 使用mvn deploy命令部署jar

两个很好的资源,其中提供了有关步骤的详细信息以及要添加到pom中的确切内容。

https://www.baeldung.com/maven-deploy-nexus

https://maven.apache.org/guides/mini/guide-3rd-party-jars-remote.html

© www.soinside.com 2019 - 2024. All rights reserved.