Create maven project is on some PC - java

I try the steps in it work at Home , when I back to work and I encounter some new problems
https://maven.apache.org/guides/getting-started/index.html#How_do_I_make_my_first_Maven_project it
mvn archetype:generate -DgroupId=com.mycompany.app
-DartifactId=Maven-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false I get the following errors
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven
-metadata.xml
Downloading: https://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metada
ta.xml
[WARNING] Could not transfer metadata org.apache.maven.plugins/maven-metadata.xm
l from/to central (https://repo.maven.apache.org/maven2): Access denied to: http
s://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-metadata.xml , R
easonPhrase:Forbidden.
[WARNING] Could not transfer metadata org.codehaus.mojo/maven-metadata.xml from/
to central (https://repo.maven.apache.org/maven2): Access denied to: https://rep
o.maven.apache.org/maven2/org/codehaus/mojo/maven-metadata.xml , ReasonPhrase:Fo
rbidden.
[WARNING] Failure to transfer org.apache.maven.plugins/maven-metadata.xml from h
ttps://repo.maven.apache.org/maven2 was cached in the local repository, resoluti
on will not be reattempted until the update interval of central has elapsed or u
pdates are forced. Original error: Could not transfer metadata org.apache.maven.
plugins/maven-metadata.xml from/to central (https://repo.maven.apache.org/maven2
): Access denied to: https://repo.maven.apache.org/maven2/org/apache/maven/plugi
ns/maven-metadata.xml , ReasonPhrase:Forbidden.
[WARNING] Failure to transfer org.codehaus.mojo/maven-metadata.xml 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 metadata org.codehaus.mojo/maven-
metadata.xml from/to central (https://repo.maven.apache.org/maven2): Access deni
ed to: https://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metadata.xml
, ReasonPhrase:Forbidden.
1) How do I test my proxy setting ? there is the username equals my PC login name?
2) How can it look for the repositories in C?
No plugin found for prefix 'archetype' in the current project and in the
plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the
[local (C:\path\to\local\repo), central (https://repo.maven.apache.
org/maven2)] -> [Help 1]
I have setting like, I though the repository suppose under my username
<!-- localRepository
| The path to the local repository maven will use to store artifacts.
|
| Default: ${user.home}/.m2/repository-->
<localRepository>/path/to/local/repo</localRepository>

Related

I have a problem when I fix my code in the first java maven project

I'm tired of trying to fix this:
com.thoughtworks.xstream:xstream:jar:1.3.1 failed to transfer from https://repo.maven.apache.org/maven2 during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of central has elapsed or updates are forced Original error: Could not transfer artifact com.thoughtworks.xstream:xstream:jar:1.3.1 from/to central (https://repo.maven.apache.org/maven2 ): The operation was cancelled.
I need help from everyone

Getting Security error while setting up the maven project - java.security.InvalidAlgorithmParameterException

I'm new to maven and setting up maven for the first time. I'm getting following error with Java and hitting mvn install command.
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 (ht
tps://repo.maven.apache.org/maven2): transfer failed for https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clea
n-plugin-2.5.pom: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non
-empty -
This would be better than a straight answer here ...
make a settings.xml in a hidden folder in your home for Maven

Couldn't create org.apache.maven.archetypes:maven-archetype-quickstart in Mac

I couldn't create a new maven project in spring test suite. Getting the following error
Could not resolve archetype org.apache.maven.archetypes:maven-archetype-quickstart:1.4 from any of the configured repositories.
Could not resolve artifact org.apache.maven.archetypes:maven-archetype-quickstart:pom:1.4
Failure to transfer org.apache.maven.archetypes:maven-archetype-quickstart:pom:1.4 from ${env.ARTIFACTORY_URL} 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.4 from/to central (${env.ARTIFACTORY_URL}): Cannot access ${env.ARTIFACTORY_URL} with type default using the available connector factories: AetherRepositoryConnectorFactory, BasicRepositoryConnectorFactory
Failure to transfer org.apache.maven.archetypes:maven-archetype-quickstart:pom:1.4 from ${env.ARTIFACTORY_URL} 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.4 from/to central (${env.ARTIFACTORY_URL}): Cannot access ${env.ARTIFACTORY_URL} with type default using the available connector factories: AetherRepositoryConnectorFactory, BasicRepositoryConnectorFactory
Failure to transfer org.apache.maven.archetypes:maven-archetype-quickstart:pom:1.4 from ${env.ARTIFACTORY_URL} 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.4 from/to central (${env.ARTIFACTORY_URL}): Cannot access ${env.ARTIFACTORY_URL} with type default using the available connector factories: AetherRepositoryConnectorFactory, BasicRepositoryConnectorFactory
Failure to transfer org.apache.maven.archetypes:maven-archetype-quickstart:pom:1.4 from ${env.ARTIFACTORY_URL} 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.4 from/to central (${env.ARTIFACTORY_URL}): Cannot access ${env.ARTIFACTORY_URL} with type default using the available connector factories: AetherRepositoryConnectorFactory, BasicRepositoryConnectorFactory
<mirrors>
<mirror>
<id>UK</id>
<name>UK Central</name>
<url>http://uk.maven.org/maven2</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
Adding the above to setting.xml would resolve the above error

Failed to create parent directories for tracking file .lastUpdated

I've added com.spotify:dockerfile-maven-plugin:1.4.3 to my POM and it
s unable to complete because of the following u
[INFO] --- dockerfile-maven-plugin:1.4.3:build (default) # server-api
--- Downloading: https://repo.maven.apache.org/maven2/com/fasterxml/jackson/module/jackson-modules-base/2.9.4/jackson-modules-base-2.9.4.pom
[WARNING] Failed to create parent directories for tracking file
/home/alex/.m2/repository/com/fasterxml/jackson/module/jackson-modules-base/2.9.4/jackson-modules-base-2.9.4.pom.lastUpdated
Which, in turn, causes:
[ERROR] Failed to execute goal
com.spotify:dockerfile-maven-plugin:1.4.3:build (default) on project
server-api: Execution default of goal
com.spotify:dockerfile-maven-plugin:1.4.3:build failed: Plugin
com.spotify:dockerfile-maven-plugin:1.4.3 or one of its dependencies
could not be resolved: Failed to collect dependencies at
com.spotify:dockerfile-maven-plugin:jar:1.4.3 ->
com.spotify:docker-client:jar:shaded:8.11.4 ->
com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:jar:2.9.4 ->
com.fasterxml.jackson.module:jackson-module-jaxb-annotations:jar:2.9.4:
Failed to read artifact descriptor for
com.fasterxml.jackson.module:jackson-module-jaxb-annotations:jar:2.9.4:
Could not transfer artifact
com.fasterxml.jackson.module:jackson-modules-base:pom:2.9.4 from/to
central (https://repo.maven.apache.org/maven2):
/home/alex/.m2/repository/com/fasterxml/jackson/module/jackson-modules-base/2.9.4/jackson-modules-base-2.9.4.pom.part.lock
(No such file or directory) -> [Help 1]
It had happened for us because some part of /.m2/repository was not having correct permissions.
I removed ~/.m2/ and it worked
I tried changing permissions of .m2 folder and repository. No luck.
Finally updated maven from 3.6.0 to 3.6.3 (latest) and it worked!
Changing the file permissions using the following command:
sudo chmod 777 repository
solves the problem

Host maven artifact with Cloudbees

I managed to have my maven jar hosted in my private repo (at least this is what I see).
https://repository-{my-library}.forge.cloudbees.com/snapshot/
When I access it from the browser the folder 'org' shows up and browsing I can see the XML and jar.
The problem is when I try to use the jar for my app, I get this error:
Downloading: http://repository-{my-library}.forge.cloudbees.com/release/org/{my-library}/{my-library}/0.0.1-SNAPSHOT/maven-metadata.xml
Downloading: https://raw.github.com/{my-library}/spring-boot-legacy/mvn-repo/org/{my-library}/{my-library}/0.0.1-SNAPSHOT/maven-metadata.xml
[WARNING] Could not transfer metadata org.{my-library}:{my-library}:0.0.1-SNAPSHOT/maven-metadata.xml from/to {my-library}-snapshot (http://repository-{my-library}.forge.cloudbees.com/release/): Not authorized , ReasonPhrase:Unauthorized.
[WARNING] Failure to transfer org.{my-library}:{my-library}:0.0.1-SNAPSHOT/maven-metadata.xml from http://repository-{my-library}.forge.cloudbees.com/release/ was cached in the local repository, resolution will not be reattempted until the update interval of {my-library}-snapshot has elapsed or updates are forced. Original error: Could not transfer metadata org.{my-library}:{my-library}:0.0.1-SNAPSHOT/maven-metadata.xml from/to {my-library}-snapshot (http://repository-{my-library}.forge.cloudbees.com/release/): Not authorized , ReasonPhrase:Unauthorized.
I don't understand why I can accesss the repo snapshot from the browser yet maven says "Unauthorized"?
You need to add a custom settings.xml to your private repository, mount it and load the configuration from there. Otherwise you won't be able to access your (protected) artifacts.
The documentation is pretty well hidden, but you can find it here: http://developer.cloudbees.com/bin/view/DEV/Accessing+under+an+external+Maven+repository

Categories

Resources