Background: I'm working on a maven project in a closed network, which means I can't connect to Maven Central. I have a repository folder containing all the artifacts I should need, including plugins and maven artifacts. Also, I can't use or install Nexus.
Problem: I want to run a Jenkins job using maven 3.6.0 / jdk 1.8.0_162. My settings.xml file is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository>D:\Maven\repository</localRepository>
<interactiveMode>false</interactiveMode>
<offline>false</offline>
<pluginGroups />
<proxies />
<servers />
<mirrors>
<mirror>
<id>ExternalRespositoryMirror</id>
<name>Maven External Repository Mirror</name>
<url>file://myserver/repository/maven/repository</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
<profiles>
<profile>
<id>jenkins</id>
<repositories>
<repository>
<id>central</id>
<name>Maven External Dependencies Repository</name>
<url>file://myserver/repository/maven/repository</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<name>Maven External Plugins Repository</name>
<url>file://myserver/repository/maven/repository</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>jenkins</activeProfile>
</activeProfiles>
</settings>
My POM's have no repository section as the jenkins slave should determine where to get those.
When I build, I get the following error though:
[ERROR] Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolved: Could not find artifact org.apache.maven.plugins:maven-clean-plugin:jar:2.5 in ExternalRespositoryMirror (file://myserver/repository/maven/repository) -> [Help 1]
I can open the file:// url and the artifact "maven-clean-plugin-2.5.jar" is in the folder \maven\repository\org\apache\maven\plugins\maven-clean-plugin\2.5
What could be the reason that maven can't find the artifact? It is present in the local repository (D:\Maven\repository) so it shouldn't actually query the network repo anyway.