mvn -rf :jeecg-boot-base-core

邢灿
2023-12-01

在Docker中安装了Jenkins,在Jenkins中构建一个Maven项目,打包运行JeecgBoot项目,后台报错:

[ERROR] Failed to execute goal on project jeecg-boot-base-core: Could not resolve dependencies for project org.jeecgframework.boot:jeecg-boot-base-core:jar:2.4.5: Failed to collect dependencies at com.baomidou:dynamic-datasource-spring-boot-starter:jar:3.2.0: Failed to read artifact descriptor for com.baomidou:dynamic-datasource-spring-boot-starter:jar:3.2.0: Could not transfer artifact com.fasterxml.jackson:jackson-bom:pom:2.8.8 from/to maven-default-http-blocker (http://0.0.0.0/): Blocked mirror for repositories: [aliyun (http://maven.aliyun.com/nexus/content/groups/public, default, releases), jeecg (http://maven.jeecg.org/nexus/content/repositories/jeecg, default, releases), central (http://maven.aliyun.com/nexus/content/groups/public/, default, releases+snapshots)] -> [Help 1]
[ERROR]
[JENKINS] Archiving /var/jenkins_home/workspace/jeecg-boot-2/jeecg-boot-module-system/pom.xml to org.jeecgframework.boot/jeecg-boot-module-system/2.4.5/jeecg-boot-module-system-2.4.5.pom
[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
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn -rf :jeecg-boot-base-core

解决办法:
1、查看Jenkins容器

docker ps

2、进入jenkins容器

docker exec -it <容器> bash

3、安装vi

apt-get update
apt-get install vim

4、进入Maven配置文件夹

cd /var/jenkins_home/tools/hudson.tasks.Maven_MavenInstallation/Maven/conf

5、修改Maven配置文件

vi settings.xml

6、屏蔽以下配置

<mirror>
      <id>maven-default-http-blocker</id>
      <mirrorOf>external:http:*</mirrorOf>
      <name>Pseudo repository to mirror external repositories initially using HTTP.</name>
      <url>http://0.0.0.0/</url>
      <blocked>true</blocked>
    </mirror>

7、增加以下配置

<mirrors>
       <mirror>
            <id>nexus-aliyun</id>
            <mirrorOf>*,!jeecg,!jeecg-snapshots,!getui-nexus</mirrorOf>
            <name>Nexus aliyun</name>
            <url>http://maven.aliyun.com/nexus/content/groups/public</url>
        </mirror> 
 </mirrors>
 类似资料: