why do I have to remove a dependency from my pom before adding it back and installing to get the latest version of my maven package?

旧巷老猫 提交于 2021-01-29 00:51:16

问题


I have a maven package I've hosted on GitHub package registry.

Whenever I make an update to the package I run mvn deploy to publish the changes, but if I simply run mvn install on the dependent application it doesn't seem to install the latest version of the package. Only after deleting the pom.xml and then loading the changes into IntelliJ, then adding it back and running mvn install does it seem to get the new publication of the package.

This is my settings.xml file:

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
                      http://maven.apache.org/xsd/settings-1.0.0.xsd">

    <activeProfiles>
        <activeProfile>github</activeProfile>
    </activeProfiles>

    <profiles>
        <profile>
            <id>github</id>
            <repositories>
                <repository>
                    <id>central</id>
                    <url>https://repo1.maven.org/maven2</url>
                    <releases><enabled>true</enabled></releases>
                    <snapshots><enabled>true</enabled></snapshots>
                </repository>
                <repository>
                    <id>github</id>
                    <name>GitHub COMPANY NAME Apache Maven Packages</name>
                    <url>https://maven.pkg.github.com/***********</url>
                </repository>
            </repositories>
        </profile>
    </profiles>

    <servers>
        <server>
            <id>github</id>
            <username>TaylorBurke</username>
            <password>****************</password>
        </server>
    </servers>
</settings>

Do I need to up the version of the package every time I publish a change? Maybe there's a configuration issue with Maven? Or perhaps this is the nature of the Maven plugin in IntelliJ?


回答1:


Select this checkbox, if you want IntelliJ IDEA to update snapshots on sync and use the SNAPSHOT dependency if you don't update the version:

  • Settings (Preferences on macOS) | Build, Execution, Deployment | Build Tools | Maven | Always update snapshots.

Make sure to click the Reimport button in the Maven tool window to synchronize the changes.



来源:https://stackoverflow.com/questions/62883251/why-do-i-have-to-remove-a-dependency-from-my-pom-before-adding-it-back-and-insta

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!