jenkins插件开发之maven国内镜像配置

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/weixin_41402059/article/details/82779129

jenkins插件开发官网指导demo:

https://jenkins.io/doc/developer/tutorial/create/

安装完maven环境,按照Jenkins知道在命令行输入

mvn -U archetype:generate -Dfilter=io.jenkins.archetypes:

实际上这个命令会在Generating project in Interactive mode阶段卡很久,把命令换成debug模式:

mvn -U -X archetype:generate -Dfilter=io.jenkins.archetypes:

可发现卡在这里

Searching for remote catalog: http://repo.maven.apache.org/maven2/archetype-catalog.xml

 网上指导说手动访问这个地址,另存archetype-catalog.xml到本地,实测会说-Dfilter=io.jenkins.archetypes:不匹配,结果生成一个空工程

解决方法:换成国内镜像,在maven安装目录conf/settings.xml里加上:

    <mirror>
      <id>repo.jenkins-ci.org</id>
      <url>https://repo.jenkins-ci.org/public/</url>
      <mirrorOf>m.g.o-public</mirrorOf>
    </mirror>
	<!-- 阿里云仓库 -->
	<mirror>
		<id>alimaven</id>
		<mirrorOf>central</mirrorOf>
		<name>aliyun maven</name>
		<url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
	</mirror>
	
	<!-- 中央仓库1 -->
	<mirror>
		<id>repo1</id>
		<mirrorOf>central</mirrorOf>
		<name>Human Readable Name for this Mirror.</name>
		<url>http://repo1.maven.org/maven2/</url>
	</mirror>
	
	<!-- 中央仓库2 -->
	<mirror>
		<id>repo2</id>
		<mirrorOf>central</mirrorOf>
		<name>Human Readable Name for this Mirror.</name>
		<url>http://repo2.maven.org/maven2/</url>
	</mirror>

猜你喜欢

转载自blog.csdn.net/weixin_41402059/article/details/82779129