Maven dependency not getting resolved in Intellij - maven

I have Maven setup and updated settings.xml with proxy settings. While working on project it is unable to load any dependency in IntelliJ.
I verified all the config with one of my friend and its working in his machine correctly. Please help.

Ensure that you are pointing to correct settings.xml in the configuration of intellij
Go to-->File-->Settings-->Build,Execution,Deployment-->Mavan
and validate user settings file and local repository file, if its having different details update the path or replace the file.

Related

Creating maven project from local Maven repo

I am trying to create a maven project in a Windows virtual machine. But am unable to create as there is a proxy setting that doesn't allow me to connect to https://repo.maven.apache.org/maven2
But I do have another link that have the maven repos. But am not sure how to create the maven project using the link that I have. Can someone help me?
Thanks
You can specify another repository in your pom.xml file, but you’ll have to do it for every maven project you’ll build.
You can also specify that repository in your settings.xml file, which will be available to all maven projects.
See the informations here : https://maven.apache.org/guides/mini/guide-multiple-repositories.html

Could not resolve archetype org.apache.maven.archetypes:maven-archetype-quickstart:1.1 from any of the configured repositories. while using in STS

I am able to create Spring Boot Starter Project and Maven Web Project from the STS, but somehow unable to create the maven-archetype-quickstart project in eclipse, its giving me below error
In my project, I am using cacert file and custom setting.xml
try
maven clean install -U
as your repository is cached so try to flush the cache using -U
I was able to solve this issue by simply deleting the .m2 folder and create maven project from scratch.
After facing the same issue and going through the message several times - I found that in the local repository i.e. .m2, under the location - org\apache\maven\archetypes\maven-archetype-quickstart\1.1 - we found the error in the file - 'm2e-lastUpdated.properties' as '#default-central-https://repo.maven.apache.org/maven2/.lastUpdated=1551236380266
https://repo.maven.apache.org/maven2/.error=Could not transfer artifact org.apache.maven.archetypes:maven-archetype-quickstart:jar:1.1 from/to central (https://repo.maven.apache.org/maven2): repo.maven.apache.org'
So my Eclipse was not able to download the required JARS may be cause it is behind the firewall and in that case - Place the 'maven-archetype-quickstart-1.1.jar' and 'maven-archetype-quickstart-1.1.pom' in your local repo at the location - 'org\apache\maven\archetypes\maven-archetype-quickstart\1.1' using the link - JARS_POM and then follow the same step to create the maven Project.
Better solution is to use proxy through 'setting.xml' file of Maven to bypass the firewall to download Maven plugins and jars.
You should also check if the maven archetype catalog to eclipse is configured properly.

How to change the location of Spring STS tool repository

I am getting the following error when run spring boot application.
Actually .m2 repository accidentally deleted. When re-running the application it is updated, but it is showing the following error. please do help in this regard.
Archive for required library:
C:/Users/Sathish/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/8.5.6/tomcat-embed-core-8.5.6.jar'
in project 'Application' cannot be read or is not a valid ZIP file
Looks like the mentioned JAR file in the local Maven repository is corrupt. I would delete this file manually from the repository, go back to STS, and run an "Maven -> Update Project...", maybe also checking the "Force Download of Snapshots/Releases". That should help.

No versions could be resolved for groupid.artifactid error when using Repository Connector

I want to simply download a war file from a Nexus repo and deploy it on a remote tomcat server.
I found this plugin https://wiki.jenkins.io/display/JENKINS/Repository+Connector+Plugin, which seems to help me do the same.
I have the following configuration:
In hue-central, I have correctly configured the repo url.
If I open <repo url>/com/worksap/company/hue-interface-front in my browser, I can see all the versions along with maven-metadata.xml, which contains all the versions.
Am I missing something?
Try following: Go to Jenkins Administration / System configuration, find the Artifact Resolver section, and check Repo Type of your repository. If it is empty, set it to "default". It was causing the same problem in my case.
Example here.

Does maven maintain any setting cache?

I comment out my local repository section im my pom.xml, but when I ran mvn eclipse: eclipse, it still try to download plugin from local repository. I also check the pom.xml it depends on and make sure to comment out them either, but this problem still occurs.
I think I might neglect some setting?
You may have a settings.xml in the default maven repository location .m2. If you are running maven inside eclipse, check your maven configuration inside Eclipse preferences, there you should find the location of the settings.xml file.

Resources