Reputation: 2828
When I want to run my junit tests, IntelliJ IDEA tries to resolve junit-platform-launcher-1.5.1 and it fails. My network is restricted and I do not have access to the internet and it should fetch it from our Artifactory server.
However, although I have set the correct settings in the project settings and also in the pom (When I run, e.g., mvn clean verify it works fine), IntelliJ tries to fetch them from repo1.maven.org (according to its log file) and it fails. Maybe IntelliJ has a hidden internal maven which does not respect the settings I have provided for the project. An strange thing about it is that it sometimes runs and sometimes tries to resolve the dependency and fails. How can I solve the problem?
The maven that my project, MAVEN_HOME, and default mvn command of the system use has a settings.xml like this:
...
<proxies>
</proxies>
<servers>
</servers>
<mirrors>
<mirror>
<id>mvn</id>
<name>...</name>
<url>...</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
<profiles>
<profile>
<id>dev</id>
<repositories>
<repository>
<localRepository>...</localRepository>
<id>mvn</id>
<name>...</name>
<url>...</url>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<actirveProfile>dev</activeProfile>
</activeProfiles>
...
Upvotes: 1
Views: 10661
Reputation: 111
This might happen due to Intellij Idea update.
After this update my maven home path has been changed to "Bundled (Maven 3)", which differs from Maven version I get from cmd (mvn -v
).
Changing maven home path to the Maven version (Settings-> Build, Execution, Deployment -> Build Tools -> Maven), which corresponds to mvn -v
version, solved the issue in my case.
Upvotes: 7
Reputation: 53462
In Settings -> Build, Execution, Deployment > Build Tools -> Maven, have something like this:
Where you explicitly point to settings.xml file where you have correct settings (ones overriding default maven repo with your artifactory repo) and override any default IntelliJ would use (tick the box!).
Upvotes: 0
Reputation: 4466
Here are the settings @Paul Rdt mentioned:
Perhaps your pom inherits a repositories setting from a parent pom that overrides the settings?
Upvotes: 3