cannot create maven project - java

I want to create maven project but failed. I use proxy in my network. I can reach "https://repo.maven.apache.org/maven2" in browser. the error show:
Could not resolve archetype
org.apache.maven.archetypes:maven-archetype-webapp:1.0 from any of the
configured repositories. Could not resolve artifact
org.apache.maven.archetypes:maven-archetype-webapp:pom:1.0 Could not
transfer artifact
org.apache.maven.archetypes:maven-archetype-webapp:pom:1.0 from/to
central (https://repo.maven.apache.org/maven2): Connect timed out
Could not transfer artifact
org.apache.maven.archetypes:maven-archetype-webapp:pom:1.0 from/to
central (https://repo.maven.apache.org/maven2): Connect timed out
I already create setting.xml and put to .m2 folder. the setting.xml contains:
<proxies>
<proxy>
<id>myproxy</id>
<active>true</active>
<protocol>http</protocol>
<host>idnproxy.myproxy.asia</host>
<port>8080</port>
<username>c76266</username>
<password>Password09</password>
<nonProxyHosts>localhost|128.*.*.*|10.*.*.*|*.intranet.asia|*.group.local</nonProxyHosts>
</proxy>
</proxies>
this setting proxy, port, username and password same with setting in my browser and I can running internet. I assume that configuration is true. how to fix this problem? thanks.

It should be settings.xml , not setting.xml
Or if you do want to use this setting.xml , from command line, point maven to this xml file
mvn -s Full_PATH_TO_setting.xml install

Related

leiningen, lein, clojure build behind proxy server with lein_tool_deps plugin

I am new to clojure and I am trying to build a porject on a system that is behind a proxy server.
Every lein command I run tries to fetch middleware dependencies using the :middleware [lein-tools-deps.plugin/resolve-dependencies-with-deps-edn] tool. However, whenever it tries to download depedencies stated within the deps.edn file Java throws a connection timeout while trying to connect to https://repo1.maven.org/maven2/
environment variables
http_proxy
https_proxy
no_proxy
are configured properly.
I configured /home/<user>/.m2/settings.xml to use the proxy as well
<?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">
<proxies>
<proxy>
<id>my-proxy</id>
<active>true</active>
<protocol>http</protocol>
<host>myproxy.....</host>
<port>XXXX</port>
<nonProxyHosts>...|*.my.domain|localhost|127.0.0.1</nonProxyHosts>
</proxy>
</proxies>
</settings>
deps.edn is
{:deps {org.clojure/clojure {:mvn/version "1.10.0"}
org.clojure/clojurescript {:mvn/version "1.10.516}
.... }
:paths ["src/cljs" "resources" "target"]
:aliases {:build {:main-opts ["-m" "figwheel.main" "-b" "dev" "-r"]}}}
Any lein command (ex: lein deps) results in Could not transfer artifact org.clojure:clojure:pom:1.10.0 from/to central (https://repo1.maven.org/maven2/): connect timed out
However, removing :middleware from the file project.clj allows me to fetch any dependency not in defined in the plugin.
How can I get the plugin to use the http proxy?

Unable to deploy maven artifact to maven central repository using travis

I am trying to deploy maven artifact to central repository through Travis but I am facing below error:
[ERROR] Failed to execute goal org.sonatype.plugins:nexus-staging-maven-plugin:1.6.7:deploy (injected-nexus-deploy) on project Test-plugin: Execution injected-nexus-deploy of goal org.sonatype.plugins:nexus-staging-maven-plugin:1.6.7:deploy failed: Nexus connection problem to URL [https://oss.sonatype.org/ ]: 401 - Unauthorized -> [Help 1]
I have set correct username and password for sonatype account, still I am getting the same error.
Below are the files uploaded:
.travis.yml
settings.xml
Looks like your settings.xml in the .m2 folder in your home directory is not having proper authorization properties set for maven to look
I am enclosing a sample XML for your reference ..
https://maven.apache.org/settings.html
<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
https://maven.apache.org/xsd/settings-1.0.0.xsd"> ... <servers>
<server>
<id>server001</id>
<username>my_login</username>
<password>my_password</password>
<privateKey>${user.home}/.ssh/id_dsa</privateKey>
<passphrase>some_passphrase</passphrase>
<filePermissions>664</filePermissions>
<directoryPermissions>775</directoryPermissions>
<configuration></configuration>
</server> </servers> ... </settings>
Here is the troubleshooting guide if you are getting 404
https://support.sonatype.com/hc/en-us/articles/213464518-Troubleshooting-Artifact-Download-Failures
From the docs
SNAPSHOT look-ups, or version ranges, or unversioned dependencies (typically plugins) will trigger metadata look-up. If the version referenced by the maven-metadata.xml is not there you will get a 404.
This can usually be fixed by running rebuild metadata on the affected artifact.

I have installed maven 3.2.3 and i tried to import one project to eclipse. I got this error [duplicate]

This question already has an answer here:
Maven build issue - Connection to repository refused
(1 answer)
Closed 6 years ago.
I'm new to maven. Please help me to solve this
[ERROR] Plugin org.apache.maven.plugins:maven-install-plugin:2.3.1 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-install-plugin:jar:2.3.1: Could not transfer artifact org.apache.maven.plugins:maven-install-plugin:pom:2.3.1 from/to central (http://repo.maven.apache.org/maven2): Connection refused to http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-install-plugin/2.3.1/maven-install-plugin-2.3.1.pom -> [Help 1]
Maven is not able download the required artifacts. Check the proxy settings in your maven settings.xml. If you are using a proxy, provide the corresponding host and port details below.
<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>

Maven Build Failure, Failed to collect dependencies at org.springframework:spring-core:jar:4.0.2.RELEASE

I've searched and searched to no luck resolving this issue. Can someone please advice me on what I can do to resolve this?
running the following command in my working project workspace
mvn compile
Produces the following error.
[ERROR] Failed to execute goal on project acme: Could not resolve
dependencies for
project com.acmecorp.acme:acme:war:GUI 5.0: Failed to collect dependencies at
org.springframework:spring-core:jar:4.0.2.RELEASE: Failed to read artifact descriptor
for org.springframework:spring-core:jar:4.0.2.RELEASE: Could not transfer
artifact org.springframework:spring-core:pom:4.0.2.RELEASE 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]
Yes i've checked my proxy in the settings.xml file in the .m2 folder. Here is what it looks like.
<proxies>
<proxy>
<active>true</active>
<protocol>https</protocol>
<username>USER</username>
<password>PASS</password>
<host>proxy.host.com</host>
<port>80</port>
</proxy>
<proxy>
<active>true</active>
<protocol>http</protocol>
<username>USER</username>
<password>PASS</password>
<host>proxy.host.com</host>
<port>80</port>
</proxy>
</proxies>
Any suggestions would be greatly appreciated.
OS Windows 7
You need to get ssl certificate of maven repo server and copy that into your local jre/lib/security folder.
Steps:
1. Download this Java program https://confluence.atlassian.com/download/attachments/180292346/InstallCert.java
Compile
Run with command line parameter maven repo server
Copy the generated ssl to your local JRE/lib/security
For detailed steps pl follow this post:
http://www.mkyong.com/webservices/jax-ws/suncertpathbuilderexception-unable-to-find-valid-certification-path-to-requested-target/

maven Could not transfer artifact, Not authorized, ReasonPhrase:Unauthorized

I added below dependency in pom.xml file:
<dependency>
<groupId>org.tuckey</groupId>
<artifactId>urlrewritefilter</artifactId>
<version>4.0.4</version>
</dependency>
I have alot of maven dependencies but when I add the one above I get:
Failed to read artifact descriptor for org.tuckey:urlrewritefilter:jar:4.0.4: Could not transfer artifact org.tuckey:urlrewritefilter:pom:4.0.4 from/to central (http://app1.stage.server.net/artifactory/libs-release): Not authorized, ReasonPhrase:Unauthorized. -> [Help 1]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
this is how the settings.xml file looks:
..
<servers>
<server>
<username>user</username>
<id>central</id>
<password>my-password</password>
</server>
<server>
<username>user</username>
<id>snapshots</id>
<password>my-password</password>
</server>
</servers>
<profiles>
...
</profiles>
<activeProfiles>
<activeProfile>artifactory</activeProfile>
</activeProfiles>
..
any help? tnx.
I faced this issue when my proxy server was not configured correctly for maven. You should check with your network administrator about proxy server and add the it in settings.xml under conf dir.
You can look for <proxies> tag and update the fields.
When I face this issue, I too felt it happened for just a few jars, but then all other required jar files were already present in my local repository and hence I was getting it for a few jars only.
I had this error trying to deploy to an internal instance of Nexus with a Maven client that was using proxies with no settings. Attempting to access a Nexus instance on the LAN via a proxy resulted in the Not authorized, ReasonPhrase:Unauthorized error.
<nonProxyHosts>internal.hostname</nonProxyHosts> fixed the issue.
Please check access of repository or password which had given in settings.xml
Adding this in case it helps someone else. In my case I was receiving this error and none of the solutions I found seemed to help. In the end I needed to add the config option to settings.xml to set interactiveMode to false.
If you are sure that your mirror links are configured properly in the settings.xml file, then please try this:
Navigate to .m2 -> repositories
Search for "lastupdated"
Delete all the files that come in the search result.
Then do a 'mvn clean install' -> new 'lastupdated' files would be created.
Try to changes groupId for the dependencies which you have added.
It work

Categories

Resources