Maven on eclipse cant download in repo - java

Why my maven cant download in mvn repo? im having this error.
[ERROR] Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.5: Could not transfer artifact org.apache.maven.plugins:maven-clean-plugin:pom:2.5 from/to central (https://repo.maven.apache.org/maven2): repo.maven.apache.org: Unknown host repo.maven.apache.org -> [Help 1]
I also tried to set the proxy
<proxies>
<proxy>
<active>true</active>
<protocol>https</protocol>
<host>host</host>
<port>port</port>
</proxy>
but i can also access https://repo.maven.apache.org/maven2 on my chrome.

Looks like your network firewall is blocking and you need to talk to your network admin. You are able to access this from chrome as it is not in blocked list but running maven command executes in different manner.
Also you can make sure this running same application on different system which is not under firewall(maybe on your own laptop)

Related

Problem while importing spring boot project

I am importing spring boot project after generating the zip file from spring.start.io -
spring.start.io
Complete project is not getting imported .It is giving errors in pom.xml like
Failure to transfer com.fasterxml.jackson:jackson-bom:pom:2.10.4 from http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact com.fasterxml.jackson:jackson-bom:pom:2.10.4 from/to central (http://repo.maven.apache.org/maven2): Failed to transfer http://repo.maven.apache.org/maven2/com/fasterxml/jackson/jackson-bom/2.10.4/jackson-bom-2.10.4.pom. Error code 501, HTTPS Required
It is imported as-
How it is imported
Where is the problem?
Could you try to add -U as argument of your mvn command to force the update of depedencies cached in your repository ? ex :
mvn -U clean install
You also have a warning about https that is required by maven central so set https in sour maven settings.xml
like :
<settings>
<mirrors>
<mirror>
<id>internal-repository</id>
<name>Maven Repository Manager running on https://repo1.maven.org/maven2</name>
<url>https://repo1.maven.org/maven2/</url>
<mirrorOf>*</mirrorOf>
</mirror>
</mirrors>
</settings>
You also have an error about https as http is no longer supported on maven repository. You have to set http://insecure.repo1.maven.org/maven2/ if you really have no choice to use insecure http. It's well documented :
https://support.sonatype.com/hc/en-us/articles/360041287334-Central-501-HTTPS-Required
Best regards.

Use Maven behind Proxy

I'm trying to set up a Maven project with NetBeans on a machine behind a proxy.
When I try to build the dependencies, I get the following error:
Plugin org.apache.maven.plugins:maven-dependency-plugin:2.6 or one of
its dependencies could not be resolved: Failed to read artifact
descriptor for
org.apache.maven.plugins:maven-dependency-plugin:jar:2.6: Could not
transfer artifact
org.apache.maven.plugins:maven-dependency-plugin:pom:2.6 from/to
central (https://repo.maven.apache.org/maven2):
sun.security.validator.ValidatorException: PKIX path building failed:
sun.security.provider.certpath.SunCertPathBuilderException: unable to
find valid certification path to requested target -> [Help 1]
As stated here, it's probably because of my proxy configuration.
Netbeans itself has access to the internet. Loading plugins etc. works:
A possible solution would be setting the proxy settings in settings.xml:
<proxy>
<id>optional</id>
<active>true</active>
<protocol>http</protocol>
<username>user</username>
<password>****</password>
<host>proxy</host>
<port>8080</port>
</proxy>
However, as the proxy configuration is set globaly, I don't have access to the parameters (user, password, etc.).
Is there any way, to get Maven to using the global proxy, as NetBeans already does, without asking the admin?

'Creating maven-archtype-quickstart' has encountered a prob

I installed maven 3.3.3 and the install was successful.
However, while trying to create a maven project in eclipse I am getting the below error
'Creating maven-archtype-quickstart' has encountered a problem
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
Failure to transfer org.apache.maven.archetypes:maven-archetype-quickstart:pom:1.1 from https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven.archetypes:maven-archetype-quickstart:pom:1.1 from/to central (https://repo.maven.apache.org/maven2): Connection refused: connect
Failure to transfer org.apache.maven.archetypes:maven-archetype-quickstart:pom:1.1 from https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven.archetypes:maven-archetype-quickstart:pom:1.1 from/to central (https://repo.maven.apache.org/maven2): Connection refused: connect
I've added proxy details to my settings.xml (got it from my browser) with/without username password
<proxies>
<proxy>
<id>462603</id>
<active>true</active>
<protocol>http</protocol>
<username>com\462603</username>
<password>xxxxxxxx</password>
<host>proxy.company.com</host>
<port>6050</port>
<nonProxyHosts>10.*|*.company.com</nonProxyHosts>
</proxy>
</proxies>
I listed this settings.xml in Eclipse->Windows->Preferences->Maven->User Settings
Also added the archtype http://repo1.maven.org/maven2/archetype-catalog.xml in Eclipse->Windows->Preferences->Maven->Archtype
Apart from all this the error still persists
I am aware there are many such duplicate question, but the solutions mentioned in all of it didn't work
Keep Connected to internet,
Step 1:- Delete .m2 folder
Step 2:- Open Eclipse click on Window->Preferences
Step 3:- Pop-Up will display , Click Maven-> Archetype
Step 4:- Click on "add remote catalog"
Step 5:- Enter the deatil
CATALOG FILE = https://repo1.maven.org/maven2/archetype-catalog.xml
DESCRIPTION = maven_catalog
Step 6:- Click on Verify , After the verification hit Ok .

Maven error : Could not calculate build plan

I am getting the following errors and i do not know why. I have set up my project on multiple environments and Ive never had any issue but recently i have added the project to an environment running Windows 8 with everything set up correctly (e.g. Maven... ) and i seem to be getting this issue
Multiple annotations found at this line:
- Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile (execution: default-compile, phase: compile)
- Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:2.5.1:testCompile (execution: default-testCompile, phase: test-compile)
- CoreException: Could not calculate build plan: Plugin org.apache.maven.plugins:maven-compiler-plugin:2.5.1 or one of its dependencies could not be resolved: Failed to read
artifact descriptor for org.apache.maven.plugins:maven-compiler-plugin:jar:2.5.1: ArtifactResolutionException: Could not transfer artifact org.apache.maven.plugins:maven-compiler-
plugin:pom:2.5.1 from/to central (http://repo.maven.apache.org/maven2): Address family not supported by protocol family: connect
- CoreException: Could not calculate build plan: Plugin org.apache.maven.plugins:maven-compiler-plugin:2.5.1 or one of its dependencies could not be resolved: Failed to read
artifact descriptor for org.apache.maven.plugins:maven-compiler-plugin:jar:2.5.1: ArtifactResolutionException: Failure to transfer org.apache.maven.plugins:maven-compiler-plugin:pom:2.5.1
from http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced.
Original error: Could not transfer artifact org.apache.maven.plugins:maven-compiler-plugin:pom:2.5.1 from/to central (http://repo.maven.apache.org/maven2): Address family not supported
by protocol family: connect
and
Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.6
Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.6
I have looked at this online and have tried numerous different things listed below to try and resolve this issue but none of them seem to work. Just to note i am not using any proxies
Delete .m2 repository, Maven -> Update Project...
Delete all .lastUpdated files, Maven -> Update Project...
Tried selecting "Force Update of Snapshots/Releases" when updating project
Does anyone have any other ideas on what i could try?
In Eclipse, go to Windows > Preferences > Maven > User Settings
In User Settings, fill in the field with the path to settings.xml > %M2_HOME%\conf (or the correct path).
it seems like that your project doesn't install the dependency needed.
Therefore you need to install it yourself.
Download both jar and pom files from the Maven Repository and installing it using the command (better than copying to the folder directly)
mvn install:install-file -Dfile=<path-to-file> -DpomFile=<path-to-pomfile>
and also be sure that you have installed all the necessary repository for the project and cross verify in the .m2/repository folder with the jar files
I had similar error while setting up my project on new VM:
"CoreException: Could not calculate build plan: Plugin org.apache.maven.plugins:maven-compiler-plugin:2.5.1 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-compiler-plugin:jar:2.5.1: ArtifactResolutionException: Failure to transfer org.apache.maven.plugins:maven-compiler-plugin:pom:2.5.1 from http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven.plugins:maven-compiler-plugin:pom:2.5.1 from/to central (http://repo.maven.apache.org/maven2): connect timed out..."
Cause and Fix for this in my case :
I have apache-maven-3.2.5 installed on the system but found that
settings.xml file is missing in .M2 folder under my user name ( C:\Users\MyUserName.m2) hence above error on building the project
Steps to fix:
Step 1: Copy settings.xml from C:\Users\Public.m2 to .m2 folder under my username on the VM ( C:\Users\MyUserName.m2)
Step2: Using CMD run a clean install after navigating to the project to see if issue is fixed and project builds without error
like this :
C:\Selenium_Test_SetupB\WebUatDemo>mvn clean install

Spring and Maven plugin installation issue; mvn; spring

i've a maven based project and i'm trying to import it to Spring source tool suite. I am getting the following error.
Description Resource Path Location Type
Could not calculate build plan: Missing:
----------
1) org.apache.maven.plugins:maven-resources-plugin:maven-plugin:2.4.2
Try downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=org.apache.maven.plugins -DartifactId=maven-resources-plugin -Dversion=2.4.2 -Dpackaging=maven-plugin -Dfile=/path/to/file
Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=org.apache.maven.plugins -DartifactId=maven-resources-plugin -Dversion=2.4.2 -Dpackaging=maven-plugin -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
----------
1 required artifact is missing.
for artifact:
org.apache.maven.plugins:maven-resources-plugin:maven-plugin:2.4.2
from the specified remote repositories:
central (http://repo1.maven.org/maven2, releases=true, snapshots=false)
Gamex Unknown Maven Problem
It looks like it's asking me to install the maven resourource plugin 2.4.2 but I'm not sure what is the file to download. I tried downloading maven-plugin-plugin-2.4.2-source.jar and feeding it to the command; but it didn't work.
I then went to the maven repository in http://svn.apache.org/viewvc/maven/plugins/tags/maven-resources-plugin-2.4.2/ and downloaded the pof.xml; this also is not working.
If you have seen this problem before pls help me understand what is missing / or what the error message is.
Thanks,
Download the maven resourource plugin 2.4.2[maven-resources-plugin-2.4.2.jar] from http://mirrors.ibiblio.org/pub/mirrors/maven2/org/apache/maven/plugins/maven-resources-plugin/2.4.2/ and do an
mvn install:install-file -DgroupId=org.apache.maven.plugins -DartifactId=maven-resources-plugin -Dversion=2.4.2 -Dpackaging=maven-plugin -Dfile=/path/to/file
followed by clean eclipse :eclipse , clean the project in Eclipse and refresh and try . It should work .
You may be behind firewall. You could try to set an HTTP proxy to bypass the firewall.
In Windows, this file is located at: C:\Documents and Settings\<windows Login>\.m2\settings.xml
You need to provide valid parameters to the <proxy> based on how the network is setup in your organization.
<settings
...
<proxies>
<proxy>
<active>true</active>
<protocol>http</protocol>
<host>put-ur-proxy-servername</host>
<port>80</port>
</proxy>
...
</settings>

Categories