You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Maven部署jackson-databind至私有仓库遇nexus插件报错求助

解决Jackson-databind部署到私有仓库时跳过Sonatype Staging插件的问题

方法1:命令行直接跳过指定插件执行

执行deploy命令时,添加参数保留默认maven部署逻辑的同时,跳过Sonatype的staging插件:

mvn clean deploy -DskipTests -Dmaven.deploy.skip=false -Dnexus-staging-maven-plugin.deploy.skip=true

参数说明:

  • -Dmaven.deploy.skip=false:确保默认的maven-deploy-plugin正常执行,将包上传到你的私有仓库
  • -Dnexus-staging-maven-plugin.deploy.skip=true:直接跳过报错的Sonatype staging部署插件

方法2:在pom.xml中强制禁用nexus-staging-maven-plugin

由于Jackson的父pom已内置该插件的执行配置,需在当前项目pom中通过pluginManagement或直接配置覆盖父pom设置:

<build>
    <plugins>
        <plugin>
            <groupId>org.sonatype.plugins</groupId>
            <artifactId>nexus-staging-maven-plugin</artifactId>
            <version>1.6.13</version>
            <configuration>
                <skip>true</skip>
            </configuration>
            <executions>
                <execution>
                    <id>injected-nexus-deploy</id>
                    <goals>
                        <goal>deploy</goal>
                    </goals>
                    <phase>none</phase>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

如果上述配置仍不生效,可改用pluginManagement块强制覆盖父pom的插件定义:

<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.sonatype.plugins</groupId>
                <artifactId>nexus-staging-maven-plugin</artifactId>
                <version>1.6.13</version>
                <executions>
                    <execution>
                        <id>injected-nexus-deploy</id>
                        <phase>none</phase>
                    </execution>
                </executions>
                <configuration>
                    <skip>true</skip>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>
</build>

方法3:临时添加空凭据配置(仅应急用)

在settings.xml中添加一个空的sonatype-nexus-staging server配置,避免插件因找不到凭据ID报错:

<servers>
    <!-- 你的私有仓库凭据 -->
    <server>
        <id>Same_as_setting.xml</id>
        <username>你的私有仓库用户名</username>
        <password>你的私有仓库密码</password>
    </server>
    <!-- 临时添加空配置 -->
    <server>
        <id>sonatype-nexus-staging</id>
        <username></username>
        <password></password>
    </server>
</servers>

验证方式

执行deploy命令后,查看日志确认只有maven-deploy-plugin在向你配置的私有仓库URL上传包,nexus-staging-maven-plugin的执行已被跳过。

内容的提问来源于stack exchange,提问作者BloodFury

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.16 05:27:40