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

idea中使用自带maven打包package,install,deploy的时候报错_第1张图片

在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中添加配置:
 

    
    
      nexus-releases
      admin
      ******
    
    
    
      nexus-snapshot
      admin
      ******
    

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

pom文件没有配置distributionManagement:
发布仓库一般分为Releases版和snapshot版,所以要配置2个仓库地址 

        
            nexus-releases
            corp nexus-releases
            http://你的nexusIP:8081/nexus/content/repositories/releases/
        
        
            nexus-snapshot
            corp nexus-snapshot
            http://你的nexusIP:8081/nexus/content/repositories/snapshots/
        
    

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

idea中使用自带maven打包package,install,deploy的时候报错_第2张图片

你可能感兴趣的:(idea中使用自带maven打包package,install,deploy的时候报错)