有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java无法使用mvn clean deploy将工件从同一台机器上载到Nexus,在我的本地Windows 10机器上运行良好

Java 11

我有一个非常基本的Spring Boot应用程序,我想在Nexus服务器上构建和部署工件

mvn清洁部署(来自我的本地Win 10机器-WORKS!!!)

mvn清洁部署(来自Nexus机器-失败??)

mvn清洁部署(来自Jenkins-失败??)

当我从本地Win 10机器运行mvn clean deploy命令时,所有工件都成功地部署在远程Nexus服务器上,我甚至可以查看和浏览它们

但是,当我克隆项目并在同一台机器上运行mvn clean deploy时,在该机器上同时安装了NexusJenkinsUbuntu框),它会给我Not authorized错误

我已经把{}和{}从我的本地{}机器复制到{}(~/.m2)安装{}的地方

我也禁用了firewalls,只是为了确保没有端口被阻止

我很困惑这些工件是如何从远程机器复制过来的,而不是从同一台机器复制过来的

pom。xml

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <configuration>
                <addResources>true</addResources>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-release-plugin</artifactId>
            <version>3.0.0-M1</version>
        </plugin>
    </plugins>
</build>

<distributionManagement>
    <snapshotRepository>
        <id>my-maven-snapshots</id>
        <url>http://my-nexus-server/nexus/repository/maven-snapshots/</url>
    </snapshotRepository>
    <repository>
        <id>my-maven-releases</id>
        <url>http://my-nexus-server/nexus/repository/maven-releases/</url>
    </repository>
</distributionManagement>

<scm>
    <connection>scm:git:https://johndoe@bitbucket.org/johndoe/todo.git</connection>
    <url>https://johndoe@bitbucket.org/johndoe/todo</url>
    <developerConnection>scm:git:https://johndoe@bitbucket.org/johndoe/todo.git</developerConnection>
    <tag>HEAD</tag>
</scm>

错误(此机器上安装了Nexus):

[INFO] --- maven-install-plugin:2.5.2:install (default-install) @ todo ---
[INFO] Installing /home/admin/cloned-apps/todo/pom.xml to /home/admin/.m2/repository/com/example/todo/0.0.2-SNAPSHOT/todo-0.0.2-SNAPSHOT.pom
[INFO]
[INFO] --- maven-deploy-plugin:2.8.2:deploy (default-deploy) @ todo ---
Downloading from my-maven-snapshots: http://my-nexus-server/nexus/repository/maven-snapshots/com/example/todo/0.0.2-SNAPSHOT/maven-metadata.xml
[WARNING] Could not transfer metadata com.example:todo:0.0.2-SNAPSHOT/maven-metadata.xml from/to my-maven-snapshots (http://my-nexus-server/nexus/repository/maven-snapshots/): Not authorized , ReasonPhrase:Unauthorized.
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for todo 0.0.2-SNAPSHOT:
[INFO]
[INFO] todo ............................................... FAILURE [  4.622 s]
[INFO] todo-webapp ........................................ SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  5.973 s
[INFO] Finished at: 2020-04-16T02:39:48Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy (default-deploy) on project todo: Failed to retrieve remote metadata com.example:todo:0.0.2-SNAPSHOT        /maven-metadata.xml: Could not transfer metadata com.example:todo:0.0.2-SNAPSHOT/maven-metadata.xml from/to my-maven-snapshots (http://my-nexus-server/nexus/repository/maven-snapshots/        ): Not authorized , ReasonPhrase:Unauthorized. -> [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

共 (0) 个答案