I'm trying to add dependencies to my project through pom file. But while building workspace it's showing error as missing more than 400 artifacts. Seems like maven is not downloading related jars to my .m2 folder.
I tried cleaning and updating projects several times but errors are still there.
Any help would be appreciated.
check your connection to repository configured in pom or settings.xml..as below
...
<repositories>
<repository>
<id>my-repo1</id>
<name>your custom repo</name>
<url>http://jarsm2.dyndns.dk</url>
</repository>
<repository>
<id>my-repo2</id>
<name>your custom repo</name>
<url>http://jarsm2.dyndns.dk</url>
</repository>
</repositories>
...
</project>
Use this link
If your are using in restricted network, please check your private organization maven repository and also check authentication to the server proxy as given on the below link and snippet
Proxies
<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">
...
<proxies>
<proxy>
<id>myproxy</id>
<active>true</active>
<protocol>http</protocol>
<host>proxy.somewhere.com</host>
<port>8080</port>
<username>proxyuser</username>
<password>somepassword</password>
<nonProxyHosts>*.google.com|ibiblio.org</nonProxyHosts>
</proxy>
</proxies>
...
</settings>
link to set proxy in settings.xml
Related
It seems like maven 3.8 has introduced some kinf of MITM attack protection, doing that it drops all the connections to the private repositories (such as nexus sonatype and so on). Here it is what happens when I try to download dependencies that are hosted into my private repository
And it stays there, waiting forever...
The private repositories are defined into the settings.xml file and everything worked perfectly (with mvn 3.6.3) until maven 3.8.
How can I put such private repositories in the "maven trusted" ones?
Here it is the settings.xml
<?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">
<profiles>
<profile>
<id>first-profile</id>
<repositories>
<repository>
<id>my-nexus</id>
<url>http://nexus.mycompany.com:8081/repository/dev/</url>
</repository>
</repositories>
</profile>
</profiles>
<servers>
<server>
<id>my-nexus</id>
<username>username</username>
<password>password</password>
</server>
</servers>
<activeProfiles>
<activeProfile>first-profile</activeProfile>
</activeProfiles>
</settings>
Overriding the shipped mirror tag from /opt/maven/conf/settings.xml by placing a new variant into the user's settings.xml, only adding local repo ids to be not considered by the mirrorOf rule, worked for me.
Maven 3.8.x
<settings>
<mirrors>
<!-- a copy of /opt/maven/conf/settings.xml, so can override with exception rules -->
<mirror>
<id>maven-default-http-blocker</id>
<mirrorOf>!my-repo1,!my-repo2,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>
</mirrors>
</settings>
I have a SpringBoot project that uses maven and IntelliJ IDEA Ultimate Edition (a build automation tool used primarily for Java projects)
I have this settings.xml for maven but when I do a mvn -U clean install, only goes the the first repository to find the files
<?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>C:/Users/sandro/.m2</localRepository>
<pluginGroups>
</pluginGroups>
<proxies>
</proxies>
<servers>
</servers>
<mirrors>
<mirror>
<id>TeamNexus1</id>
<mirrorOf>*</mirrorOf>
<name>TeamNexus1</name>
<url>http://benficiones.com:8081/nexus/content/groups/public/</url>
</mirror>
<mirror>
<id>TeamNexus2</id>
<mirrorOf>*</mirrorOf>
<name>TeamNexus2</name>
<url>http://benficiones2.com:8081/nexus/content/groups/public/</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>p1</id>
<repositories>
<repository>
<id>TeamNexus1</id>
<name>TeamNexus1</name>
<url>http://benficiones.com:8081/nexus/content/groups/public/</url>
<releases><enabled>true</enabled><updatePolicy>always</updatePolicy></releases>
<snapshots><enabled>true</enabled><updatePolicy>always</updatePolicy></snapshots>
</repository>
<repository>
<id>TeamNexus2</id>
<name>TeamNexus2</name>
<url>http://benficiones2.com:8081/nexus/content/groups/public/</url>
<releases><enabled>true</enabled><updatePolicy>always</updatePolicy></releases>
<snapshots><enabled>true</enabled><updatePolicy>always</updatePolicy></snapshots>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>p1</activeProfile>
</activeProfiles>
</settings>
You defined TeamNexus1 als <mirrorOf> everything. This means that any requests, to whatever repository they go, are redirected to TeamNexus1.
This is probably not what you want.
If you want to use the two repositories in addition to MavenCentral (which is implicitly configured), you can just remove the whole <mirrors> section.
I have a spring-boot application (myapp) with drools the kie-ci module enabled (the drools version i use i the 7.13.0.Final).
I also host my kjars to a remote nexus maven repository.
KieScanner is not fully operative with remote nexus repository.
At the time of project building for first time, all the κjars are detected and downloaded in my local maven repo but when myapp is running the remote updated kjars are not detected by kiescanner.
When i manually delete the local kjars from the .m2 repository, then the latest kjars are downloaded locally and kiescanner detects them.
Seems to be more a maven issue than a drools issue.
My settings.xml maven file is the following:
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd">
<servers>
<server>
<id>nexus-snapshots</id>
<username>admin</username>
<password>admin123</password>
</server>
<server>
<id>nexus-releases</id>
<username>admin</username>
<password>admin123</password>
</server>
</servers>
<mirrors>
<mirror>
<id>central</id>
<name>central</name>
<url>http:///XXX.XXX.X.ΧΧ:8081/repository/maven-group/</url>
<mirrorOf>*</mirrorOf>
</mirror>
</mirrors>
<profiles>
<profile>
<id>myprofile</id>
<repositories>
<repository>
<id>maven-snapshots</id>
<url>http://XXX.XXX.X.ΧΧ:8081/repository/maven-snapshots/</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
</profile>
</profiles>
</settings>
and i execute myapp by the following format:
java -jar -Dspring.profiles.active=myprofile target/myapp-0.0.1-SNAPSHOT.jar
How i can make myapp to detect remote nexus updated kjars dynamically?
Thank you very much for you time!
I have server that use saml access
I want to write java application that get dependencies from this server.
I created settings.xml
<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">
<servers>
<server>
<id>repoID</id>
<username>myuser</username>
<password>mypaswrod</password>
</server>
</servers>
<profiles>
<profile>
<id>snapshot.build</id>
<repositories>
<repository>
<id>repoID</id>
<url>my-url</url>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>snapshot.build</activeProfile>
</activeProfiles>
</settings>
when I tried to run mvn clean install I got error from mvn because the SAML.
The error because it the mvn didn't succeed to download the relevant dependencies.
The error from MVN "no checkssum avaliable", when I tried to open the file that was download I got html error of SAML
Does MVN support SMAL access ?
I've run into a situation where configuring Nexus as a Mirror for everything doesn't quite suit my needs. My Nexus repository is behind a VPN. If I can't access the Nexus repository, I can't build anything because it's configured as a Mirror. What if I want to build a project that has no dependencies on my Nexus repository yet I can't access it? This would build fine by simply using the Central repository but it won't look there because of the Mirror.
Does anyone have any ideas on how to get around this? I think ideally I'd like to look at Nexus first but if it's not accessible I'd like to look at the Central repository. I'm also open to any other suggestions for achieving the same goal that anyone may have.
you need to configure multiple repositories
http://maven.apache.org/guides/mini/guide-multiple-repositories.html
maven-3.0.4\conf\settings.xml file could be configured this way:
<?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">
<pluginGroups />
<proxies />
<servers>
<server>
<!-- local repository have restricted access -->
<id>central</id>
<username>myusername</username>
<password>mypassword</password>
</server>
<server>
<id>LocalRepository</id>
<username>myusername</username>
<password>mypassword</password>
</server>
</servers>
<mirrors>
<mirror>
<id>central</id>
<mirrorOf>external:*</mirrorOf>
<name>Central</name>
<url>url to repository</url>
</mirror>
<mirror>
<id>LocalRepository</id>
<mirrorOf>LocalRepository</mirrorOf>
<name>repository</name>
<url>url to repository</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>central</id>
<repositories>
<repository>
<id>central</id>
<name>Central</name>
<url>http://central/</url>
<releases>
<enabled>true</enabled>
</releases>
</repository>
<repository>
<id>LocalRepository</id>
<name>specific repository</name>
<url>repository URL</url>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>central</activeProfile>
</activeProfiles>
</settings>
The best approach for this kind of requirement is to run Nexus locally on your development machine.
Its easy to install and run and you can just always point to it.
Configure it to proxy your corporate Nexus and Central.
Then when you are off the VPN .. the corporate proxy repo will just be unreachable but you still get anything else just fine. Nexus manages it all for you.
I have been doing this for years and it allows me to switch to different contexts all the time very easily. It is a bit of a standard practice for many Maven users in fact and should be for other tools that use remote repositories like Gradle or SBT as well. Makes things a LOT easier.