[New maven project in eclipse on MacOS]How to solve "Could not resolve archetype..."? - eclipse

I am working on MacOS 10.14.6 with:
java version "12.0.2" 2019-07-16
Apache Maven 3.6.2
Eclipse IDE for Java Developers Version: 2019-06 (4.12.0)
When I tried to open a new maven project, the following error happened:
Could not resolve archetype org.apache.maven.archetypes:maven-archetype-quickstart:1.1 from any of the configured repositories.
Could not resolve artifact org.apache.maven.archetypes:maven-archetype-quickstart:pom:1.1
Could not transfer artifact org.apache.maven.archetypes:maven-archetype-quickstart:pom:1.1 from/to central (https://repo.maven.apache.org/maven2): repo.maven.apache.org
Could not transfer artifact org.apache.maven.archetypes:maven-archetype-quickstart:pom:1.1 from/to central (https://repo.maven.apache.org/maven2): repo.maven.apache.org
I have tried the following:
set proxy in settings.xml and place it in .m2 folder
<proxies>
<proxy>
<id>myproxy</id>
<active>true</active>
<protocol>http</protocol>
<username>****</username>
<password>****</password>
<host>proxy****</host>
<port>**</port>
<nonProxyHosts></nonProxyHosts>
</proxy>
</proxies>
set proxy in network connections in eclipse
configure the settings.xml paths of global and user settings in eclipse as the settings.xml in the installed folder
delete .m2 folder and restart eclipse
add remote archetype catalog with the path
http://repo1.maven.org/maven2/archetype-catalog.xml
May I have your kind help to solve this?

The issue is solved by adding the mirror content in the settings.xml. https://maven.apache.org/guides/mini/guide-mirror-settings.html

Related

Spring boot not compiling

I am trying to compile the project https://github.com/spring-cloud/spring-cloud-aws but the parent project has references to flatten-maven-plugin thus i am getting the error.
If this plugin is public i am not sure why i am getting the error as below. I am not able to get rid of this plugin. I opened a ticket on the git project but as it may not gather any answer.
Error resolving version for plugin 'org.codehaus.mojo:flatten-maven-plugin' from the repositories [local (C:\Users\ranajit.jana\.m2\repository), central (https://repo.maven.apache.org/maven2)]: Plugin not found in any plugin repository pom.xml /spring-cloud-aws-**** line 1 Maven pom Loading Problem
I am compiling this code as i want to make some changes.
Anyone has idea what can be done ?
=============================
This is resolved now.
This is was repo issue the plugin repo was pointing to repo1.maven.apache.org/maven2 which could not resolve this plugin.
I had to add the following to resolve this issue..
This is added as one additional plugin repo
<pluginRepository>
<id>maven-plugin-repo-mvn</id>
<name>Maven plugin repo maven</name>
<url>https://repo.maven.apache.org/maven2</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
Open the .m2/repository and proceed to the path org/codehaus/mojo/flatten-maven-plugin/. There delete the subdirectory version number. and all contained files. Maven will automatically download them the next time they are required.

Maven proxy configuration not working

I know there are already many questions on this subject but somehow I can't work out how to use maven 3.0.5 behind a proxy.
The settings.xml file inside my .m2/ folder looks like this
<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>http-proxy</id>
<active>true</active>
<protocol>http</protocol>
<host>proxyname</host>
<port>8080</port>
<username>Domain\user</username>
<password>password</password>
<nonProxyHosts>127.0.0.1</nonProxyHosts>
</proxy>
</proxies>
</settings>
I also added wagon-http-lighteweight-2.2.jar to MAVEN_HOME/lib/ext.
I'm using maven inside eclipse, but it's showing the correct settings file in eclipse maven properties.
Despite having all these settings I still get the following error message after importing a spring boot project:
Project build error: Non-resolvable parent POM for <ProjectName>:0.0.1-SNAPSHOT: Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:1.4.1.RELEASE from/to central (https://repo.maven.apache.org/maven2): Failed to authenticate with proxy and 'parent.relativePath' points at no local POM
After running maven with the -X switch like Little Santi suggested I saw that the proxy is not the problem but the company I work in uses lokal maven repositories which I had to include.
I added these repositories and mirrors to my settings.xml and now it's working fine.

Using artifacts from Eclipse Luna P2 repository in Maven

Has anybody an idea how to define a regular Maven dependency against an artifact that is hosted in an Eclipse P2 repository (e.g http://download.eclipse.org/releases/luna)? The only answer I found was this: Use dependencies from Eclipse p2 repository in a regular Maven build?.
In my case I cannot change from the pom-first approach to the manifest-first approach and especially, I don't want to change the packaging from bundle to eclipse-plugin. Unfortunately, I cannot find any up-to-date releases in any of the public Maven repositories.
The artifacts I am interested in are:
org.eclipse.equinox:org.eclipse.equinox.http.jetty:3.0.200.v20131021-1843
org.eclipse.equinox:org.eclipse.equinox.http.servlet:1.1.500.v20140318-1755
I have tried it with simply defining the Eclipse P2 Repository in my root pom:
<repository>
<id>eclipse-luna-repository</id>
<url>http://download.eclipse.org/releases/luna</url>
<layout>p2</layout>
</repository>
Of course this does not work and I get the following error:
Could not transfer artifact org.eclipse.equinox\:org.eclipse.equinox.http.jetty\:pom\:3.0.200.v20131021-1843 from/to eclipse-luna-repository (http\://download.eclipse.org/releases/luna)\: No connector available to access repository eclipse-luna-repository (http\://download.eclipse.org/releases/luna) of type p2 using the available factories WagonRepositoryConnectorFactory
Has anybody an idea how to solve this problem?

Maven project Creation - While creating project from Eclipse failed

I am able to create the maven project from command line but not able to create project from eclipse.I have configured same maven as external in eclipse. When i am trying to create maven project , its giving me below error. How to fix the below error.
My eclipse version is kepler
Could not calculate build plan: Plugin org.apache.maven.plugins:maven- resources-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-
plugin:jar:2.5
Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.5
Please advise.
Try this:
1: Delete .M2 Content
2: Set the Proxy configuration in settings.xml
<proxies>
<proxy>
<active>true</active>
<protocol>http</protocol>
<host>proxy.com</host>
<port>xxxx</port>
<nonProxyHosts>local.net</nonProxyHosts>
</proxy>
</proxies>
Be careful! don't put any username and passowrd if proxy is without auth
3: Close Eclipse..and reopen
4: clean and update project configuration
5: verify the java buld path used for the project configuration
6: Try use the Maven embedded in eclipse just for a test, to see if the problem is the external Maven installation corrupted

Eclipse 3.7 (Indigo): How to add a remote Maven 2 repository mirror

I recently installed Eclipse 3.7 (Indigo) and now a wanted to start a new project using the integrated Maven plugins.
Problem is, I can't download any dependencies from the central maven 2 repository http://repo1.maven.org/maven2
After creating a new simple Maven project (without an archetype), i constantly get these Error messages:
Description Resource Path Location Type
CoreException: Could not calculate build plan: Plugin org.apache.maven.plugins:maven-compiler-plugin:2.3.2 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-compiler-plugin:jar:2.3.2: ArtifactResolutionException: The repository system is offline but the artifact org.apache.maven.plugins:maven-compiler-plugin:pom:2.3.2 is not available in the local repository. pom.xml /JAVA line 1 Maven Project Build Lifecycle Mapping Problem
Description Resource Path Location Type
Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:2.4.3 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.4.3 pom.xml /JAVA line 1 Maven Build Problem
Description Resource Path Location Type
Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (execution: default-compile, phase: compile) pom.xml /JAVA line 1 Maven Project Build Lifecycle Mapping Problem
Description Resource Path Location Type
Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:2.3.2:testCompile (execution: default-testCompile, phase: test-compile) pom.xml /JAVA line 1 Maven Project Build Lifecycle Mapping Problem
Using an archetype doesn't work at all.
Am I right to just add another repository mirror to get the needed dependencies?
If so, how do I add another one?
Update: I wrote a D:\Users\.m2\settings.xml manually and the m2e-plugin recognized it correctly:
<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/>
<interactiveMode/>
<usePluginRegistry/>
<offline/>
<pluginGroups/>
<servers/>
<mirrors>
<mirror>
<id>dotsrc.org</id>
<url>http://mirrors.dotsrc.org/maven2</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
<proxies/>
<profiles/>
<activeProfiles/>
</settings>
Problem is: I can't find a complete mirror of the Maven central repository. I tried every single one I could find on the net, but all are missing some dependencies, archetypes, etc.
Any help out there?
Try one of these.