maven工程的common模块jar上传至仓库并被其它模块依赖
1.parent pom和common pom 都需要添加 <distributionManagement> <repository> <id>nexus</id> <name>nexus thirdparty repositories</name> <url>http://10.74.11.37:8081/nexus/content/repositories/thirdparty</url> </repository> </distributionManagement> 其中id要与maven的配置文件settings.xml里面的 <server> <id>nexus-releases</id> <username>admin</username> <password>mtait</password> </server> <server> <id>nexus-snapshots</id> <username>admin</username> <password>mtait</password> </server> <server> <id>nexus</id> <username>admin</username> <password>mtait</password> </server> <server> <id>tomcat.server</id> <username>mtait</username> <password>mtait</password> </server> </servers> id保持一致; 2.common jar自动上传至maven仓库,右键common工程,run as--》build...--》goals里面填入deploy--》run,就会自动上传至maven仓库 但,有一个前提在私库内,点击Repository,选择存放jar的路径--》Configuration--》Access settings--》Deployment Policy--》选择Allow Redeploy 3.parent pom里面 <dependency> <groupId>com.mintaian.riskcontrol</groupId> <artifactId>riskcontrol-common</artifactId> <version>1.0.0</version> </dependency> 其它模块pom <dependency> <groupId>com.mintaian.riskcontrol</groupId> <artifactId>riskcontrol-common</artifactId> </dependency> 4.依赖里面可能引入的不是jar而是本地项目,解决办法:右键项目--》maven--》选择Enable Workspace Resolution,这是引入的就是jar