idea中使用自带maven打包package,install,deploy的时候报错

在install成功iql-common后,同时iql-web和iql-engine这两个刚才中引用到了iql-common包,打包iql-web和iql-engine的时候,出现了如下错误:

"C:\Program Files\Java\jdk1.8.0_161\bin\java" -Dmaven.multiModuleProjectDirectory=D:\ideatest\IQL\iql-web -Dmaven.home=E:\apache-maven-3.5.3 -Dclassworlds.conf=E:\apache-maven-3.5.3\bin\m2.conf "-javaagent:D:\Program Files\IntelliJ IDEA 2017.2.3\lib\idea_rt.jar=52757:D:\Program Files\IntelliJ IDEA 2017.2.3\bin" -Dfile.encoding=UTF-8 -classpath E:\apache-maven-3.5.3\boot\plexus-classworlds-2.5.2.jar org.codehaus.classworlds.Launcher -Didea.version=2017.2.3 -s E:\apache-maven-3.5.3\conf\settings.xml -Dmaven.repo.local=D:\repository package
[INFO] Scanning for projects...
[INFO] 
[INFO] ---------------------------< cn.i4:iql-web >----------------------------
[INFO] Building iql-web 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.977 s
[INFO] Finished at: 2018-11-19T14:56:05+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project iql-web: Could not resolve dependencies for project cn.i4:iql-web:jar:1.0-SNAPSHOT: Failed to collect dependencies at cn.i4:iql-common:jar:1.0-SNAPSHOT: Failed to read artifact descriptor for cn.i4:iql-common:jar:1.0-SNAPSHOT: Failure to find cn.i4:iql:pom:1.0-SNAPSHOT in http://maven2.qq.com/nexus/content/repositories/snapshots was cached in the local repository, resolution will not be reattempted until the update interval of nexus-snapshots has elapsed or updates are forced -> [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

Process finished with exit code 1

初步确实是maven中央仓库环境问题引起的:

报错提示是无法找到父工程的cn.i4:iql:pom:1.0-SNAPSHOT包,去本地repository查询确实没有此jar包,同时报了另外一个错

Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project admin: Deployment failed: repository element was not specified in the POM inside distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter -> [Help 1]

故在maven的settings.xml文件中加如下配置:

在setting.xml中添加配置:
 
<servers>
    <!-- 发布Releases版的账号,ID要与distributionManagement中的Releases ID一致 -->
    <server>
      <id>nexus-releases</id>
      <username>admin</username>
      <password>******</password>
    </server>
    <!-- 发布snapshot版的账号,ID要与distributionManagement中的snapshot ID一致 -->
    <server>
      <id>nexus-snapshot</id>
      <username>admin</username>
      <password>******</password>
    </server>
</servers>

同时在项目的父工程pom.xml里面添加如下:

pom文件没有配置distributionManagement:
发布仓库一般分为Releases版和snapshot版,所以要配置2个仓库地址 
<distributionManagement>
        <repository>
            <id>nexus-releases</id>
            <name>corp nexus-releases</name>
            <url>http://你的nexusIP:8081/nexus/content/repositories/releases/</url>
        </repository>
        <snapshotRepository>
            <id>nexus-snapshot</id>
            <name>corp nexus-snapshot</name>
            <url>http://你的nexusIP:8081/nexus/content/repositories/snapshots/</url>
        </snapshotRepository>
    </distributionManagement>

然后直接对父工程pom.xml进行打包package,相关子工程jar都成功打包

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值