问题现场
1.项目使用idea maven lifecycle的deploy,关键是直接上传成功了
nexus上也有这个这个包
2.其它项目配置nexus地址,拉取该jar
<!--deploy版本到私服需要该配置,后期可将common等jar放到私服去-->
<distributionManagement>
<repository>
<!--注意该ID必须与与settings.xml配置的server节点配置的id一致,name随意-->
<id>ksc-maven</id>
<name>nexus3私服</name>
<url>${ksc-nexus3}</url>
</repository>
</distributionManagement>
<!--依赖仓库,阿里云及ksc-nexus3私服-->
<repositories>
<repository>
<!--从私服的拉取jar包,id,name随意-->
<id>xxxx</id>
<name>nexus3私服</name>
<url>${ksc-nexus3}</url>
</repository>
<repository>
<id>maven-ali</id>
<url>http://maven.aliyun.com/nexus/content/groups/public//</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
reimport只有没有jar
install找不到jar
[ERROR] Failed to execute goal on project vehicle-manage: Could not resolve dependencies for project com.construn:vehicle-manage:jar:0.0.1-SNAPSHOT: Failed to collect dependencies at com.xuxueli:xxl-job-core:jar:2.3.3: Failed to read artifact descriptor for com.xuxueli:xxl-job-core:jar:2.3.3: Could not find artifact com.xuxueli:xxl-job:pom:2.3.3 in xxxx (http://xxxx:xxxx/repository/ksc-maven-mixed/) -> [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/DependencyResolutionException
web页面手动上传测试
可以正常拉取
正确deploy姿势
1.使用maven-depoy-plugin发布插件。pom配置maven-deploy-plugin插件再次点击IDEA lifecycle->deploy,因为maven-depoy-plugin插件执行goal挂到了maven生命周期deploy上
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.7</version>
<executions>
<execution>
<id>default-deploy</id>
<phase>deploy</phase>
<goals>
<goal>deploy</goal>
</goals>
<!-- skip默认deploy插件的执行 -->
<configuration>
<skip>true</skip>
</configuration>
</execution>
<execution>
<id>deploy-file</id>
<phase>deploy</phase>
<goals>
<goal>deploy-file</goal>
</goals>
<configuration>
<!-- 开发阶段上传到snapshot仓库,上线阶段上传到release仓库 -->
<repositoryId>ksc-maven</repositoryId>
<url>http://xxxx/repository/ksc-maven-mixed/</url>
<file>${project.build.directory}/${project.artifactId}-${project.parent.version}.jar</file>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<version>${project.version}</version>
</configuration>
</execution>
</executions>
</plugin>
其它问题401
1.检查要发布的jar的pom:distributionManagement->repositry的ID必须与settings.xml中server的id一致,这样maven便会以该ID对应用户的账号密码进行发布,
<distributionManagement>
<repository>
<id>ksc-maven</id>
<name>ksc-maven-mixed</name>
<url>http://xxxx/repository/ksc-maven-mixed/</url>
</repository>
</distributionManagement>
<server>
<id>ksc-maven</id>
<username>deployer</username>
<password>deployer</password>
</server>
2.要保证deployer用户具有ksc-maven-mixed仓库的发布权限
3.如果还是401,可能是IDE maven参数设置环境问题