maven 打包source.jar到本地仓库


A项目依赖另外一个B项目的install的jar,调试A项目到B项目代码查看源代码发现是压缩了的

 downloadSources会在远程仓库去下载source.jar因为远程仓库没有。所以自己B项目打包需要配置插件打包source.jar到maven仓库‘

 <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.pluginsgroupId>
        <artifactId>maven-source-pluginartifactId>
        <executions>
          <execution>
            <id>attach-sourcesid>
            <goals>
              <goal>jargoal>
            goals>
          execution>
        executions>
      plugin>
   plugins>
build>

重新执行

 mvn clean  install  -Dmaven.test.skip=true 

含有源码包可以调试源码了