idea使用maven上传源码的坑处理

1、配置maven的setting.xml账号密码,不配置会提示401,权限不足

 <servers>
        <server>
            <id>releases</id>
            <username>admin</username>
            <password>admin123</password>
        </server>
        <server>
            <id>snapshots</id>
            <username>admin</username>
            <password>admin123</password>
        </server>
    </servers>
2、
在项目的pom.xml中增加以下内容,由于是多模块项目,需要分别配置父类和子类source插件

父类配置

<pluginManagement>
   <plugins>
      <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-source-plugin</artifactId>
          <version>3.0.1</version>
          <configuration>
             <attach>true</attach>
          </configuration>
             <executions>
                 <execution>
                     <phase>compile</phase>
                         <goals>
                            <goal>jar</goal>
                         </goals>
                 </execution>
            </executions>
        </plugin>
    </plugins>
</pluginManagement>

<distributionManagement>
        <repository>
            <id>releases</id>
            <url>http://xxx:8081/nexus/content/repositories/thirdparty/</url>
        </repository>
        <snapshotRepository>
            <id>snapshots</id>
            <url>http://xxx:8081/nexus/content/repositories/thirdparty</url>
        </snapshotRepository>
    </distributionManagement>
子类配置
    <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
      </plugin>
    </plugins>
  </build>
3、重点来了

配置好上面的一切之后使用idea右侧的maven命令双击
在这里插入图片描述
clean、install死活不会生成source.jar,
2、后面尝试使用右上角mvn命令,
在这里插入图片描述
在这里插入图片描述
但是发现调用的是默认c盘下面的setting.xml配置,因为没有配所以直接就报错了,大概是没有权限401的错误
3、再后来,在这里插入图片描述
此处点右键会生成一个maven命令,然后输入命令clean source:jar deploy

至此,完美上传源码
总结:idea虽然配置了打包源码的插件,但是idea右侧maven生命周期deploy时是没有打包源码操作的,所以需要输入命令先打包源码source:jar,再完成发布
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值