首页 文章

nexus / maven部署到nexus服务器的旧IP

提问于
浏览
0

我将RHEL7的AWS EC2实例用于jenkins master并在其上安装了sonarqube,nexus,maven ..在安装和配置之后我在jenkins上运行了一些工作似乎很好,后来我的服务器似乎挂了所以我不得不停下来启动它 . 这使得RHEL服务器的IP发生了变化 .

现在当我正在尝试运行maven部署的工作时...... sonarqube试图访问旧的服务器IP并且我在jenkins>全局配置中进行了更改 . 所以sonarqube现在工作正常 . 但在那之后,maven正试图访问我的旧服务器IP和nexus端口 . 我无法弄明白我可以修改的地方 .

Ps:我运行的工作来自不属于我的git存储库,我没有克隆它,所以我们考虑不能访问该项目的pom.xml文件 .

我跟着这个nexus安装[1] https://devopscube.com/how-to-install-latest-sonatype-nexus-3-on-linux/
Git项目网址:https://github.com/vemular1/dev-maxo-demo/

我在部署它时遇到的错误,maven部署仓库的目标是旧IP .

--- maven-install-plugin:2.4:install (default-install) @ maxotech ---
[INFO] Installing /var/lib/jenkins/workspace/deploy/target/maxotech-1.4.jar to /var/lib/jenkins/.m2/repository/com/maxo/maxotech/1.4/maxotech-1.4.jar
[INFO] Installing /var/lib/jenkins/workspace/deploy/pom.xml to /var/lib/jenkins/.m2/repository/com/maxo/maxotech/1.4/maxotech-1.4.pom
[INFO] 
[INFO] --- maven-deploy-plugin:2.7:deploy (default-deploy) @ maxotech ---
Uploading to deploymentRepo: http://35.193.152.132:8081/repository/maven-releases/com/maxo/maxotech/1.4/maxotech-1.4.jar
Uploading to deploymentRepo: http://35.193.152.132:8081/repository/maven-releases/com/maxo/maxotech/1.4/maxotech-1.4.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 04:20 min
[INFO] Finished at: 2018-06-20T13:47:39Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project maxotech: Failed to deploy artifacts: Could not transfer artifact com.maxo:maxotech:jar:1.4 from/to deploymentRepo (http://35.193.152.132:8081/repository/maven-releases/): Connect to 35.193.152.132:8081 [/35.193.152.132] failed: Connection timed out (Connection timed out) -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Build step 'Invoke top-level Maven targets' marked build as failure
Finished: FAILURE

我是stackoverflow的新手,如果我没有按照格式发布,请告诉我 .

1 回答

  • 0

    重启后,使用EC2实例中新分配的IP更新 pom.xml ,并为maven项目刷新 .

    mvn clean install -U

    此外,正如您在重新启动后正确提到的IP更改,您可能需要为您的实例提供弹性IP,这样您就不必每次都执行此更改 .

    <distributionManagement>
        <repository>
            <id>deploymentRepo</id>
            <name>Internal Releases</name>
            <url>http://35.193.152.132:8081/repository/maven-releases/</url>
        </repository>
    
        <snapshotRepository>
            <id>deploymentRepo</id>
            <name>Internal Releases</name>
            <url>http://35.193.152.132:8081/repository/maven-snapshots/</url>
        </snapshotRepository>
    
    </distributionManagement>
    

相关问题