Running "mvn archetype:generate" stalls - windows-7

When I try to run the command mvn archetype:generate it stalls when trying to download maven-assembly-plugin-2.2-beta-5.jar
No matter how many times I cancel the batch process or close cmd and restart, it still stops at the same point when I try again. The last attempt produced the following result:
d:\Workshop\dev\java\projects\default\spring-test-web>mvn archetype:generate
[INFO] Scanning for projects...
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-assemb
ly-plugin/2.2-beta-5/maven-assembly-plugin-2.2-beta-5.jar
65 KB
Can anyone help me out with this? I'm using Windows 7 and Maven v3.0.3 which as far as I know is installed correctly.

Check if your development machine needs a HTTP proxy to access the internet - you might be able to establish this by checking your browser settings.
If you find you need a proxy server, see Maven - Configuring a proxy.

I have a similar problem on Windows Vista with just about everything Maven might want to download.
If I'm lucky can usually get around it by killing Maven (CTRL+C) and then re-running whatever task I was trying to do. Since Maven will only download the stuff once, the problem doesn't matter unless I'm using a plugin for the first time
UPDATE (V2)
I have this problem at work, but not at home.
I have AVG at work and not at home - at home I have Avast.
It works fine with the Link Scanner and Online Shield components disabled - your mileage may vary

I was having exactly the same problem and had AVG running virus check.
Temporarilly disabling it and restarting the mvn command worked perfectly.

I had the same problem and solved it with adding proxy in setings file in maven configuration.
Just add something like this:
<proxy>
<id>optional</id>
<active>true</active>
<protocol>http</protocol>
<username></username>
<password></password>
<host>proxy.yourHost</host>
<port>8080</port>
<nonProxyHosts>yourHost</nonProxyHosts>
</proxy>

Related

mvn clean install stuck when doing tests - what am i missing?

I want to run my app as a windows service so i modified my pom to include
executable / true.
I tried "mvn clean install" - after a few moments, it starts doing tests but after more than 3 hours it shows only messages about websocket. I have websocket in my project, but what is the problem? Why the long running time ? Am i missing something ?
EDIT: I'm sorry about the picture, i thought the image would say more than i could say.
The only thing new about my project is the "executable - true " in the pom. I removed it and tried mvn clean install with another failure. I am thinking it has something to do with my mvn packages ? I am starting to remove them one by one to identify the source.
EDIT2: I found the source: removing websocket dependency completes mvn clean install in under 2 minutes. What is the message? Is it something wrong with my websocket ? It is the spring-boot-starter-websocket dependency.
I don't understand, why running the app in intellij works and mvn clean install doesn't ?
After simulating on a local project i believe that a local test is keeping the connection open and won't let spring finish.
Check the test and first uncomment it to isolate the problem.

Why does mvn command take forever?

$ mvn dependency:tree -Dincludes=com.fasterxml.jackson.core
[INFO] Scanning for projects...
Downloading from central: https://repo.maven.apache.org/maven2/org/jooq/jooq-codegen-maven/3.9.1/jooq-codegen-maven-3.9.1.pom
I am executing this command, but it takes forever and got stuck here. My network is all good and I tried the command at different time but ended with the same. What might be the problem?
I've seen all kinds of problems with this. No idea what your specific issue is but here's a few possibilities
Your traffic is going through some kind of stateful package inspection/firewall/antivirus/IDS/bluecoat/etc and it's interfering and/or silently dropping the connection
There's some issues validating the certificate
The server is offline, which happens from time to time but is unlikely
Your settings.xml file is redirectly elsewhere and that "elsewhere" location is misbehaving.
A few suggestions to work around the issue
try disabling https (i know) by using settings.xml to remap the apache repo from https to http.
try disabling any antivirus/firewall (temporarily) to try and isolate the problem.
check to make sure your hard drive is not full
To troubleshoot run mvn with --debug flat to see any issues to find if mvn is stuck on any command. Based on this, if you still need help, please update this question
mvn --debug ...

Build Error while building aperturejs

I am trying to build aperturejs with Readme.md instructions.
I cloned the repository and tried the command mvn clean install in the root directory of ApertureJs.
I got the following Build Error as in the screenshot,
I am using the latest version of Maven - 3.3.9
Thanks in advance.
By reading the error in your console, I could feel that you are not authorized to access the particular repository, which is shown in your console.
Copy the repository url and try it from a browser - hope you will not be able to access the repository, since you are not authorized.
Raise appropriate access and after getting access, then try mvn clean install.
Below is the Quick fix till the time you get the access:
Copy and Paste the respective jar/pom/folder from your colleague machine, in your .m2/repository/...
Run the mvn clean install with -o option so that it will look into your local repository for building your application
Thank you. The issue is solved. I posted this issue to Uncharted Software's Salt Repository and exactly like Clement Said, I was trying to access a repository that no more has access publicly. Therefore they gave a workaround.
It is available here -> https://github.com/unchartedsoftware/aperturejs/issues/22
Thanks a lot.

Maven - peer not authenticated

A few days ago my maven stopped working. To be more specific it stops download dependencies. Below I note bunch of information and steps which I did in order to find solution.
I double checked settings.xml - this file is used also by my colleagues and they haven't any problems
I installed Maven 3.0.4, 3.0.5, 3.1.0 - it always fail during download dependencies
I have 3 computers - 2 with Ubuntu and 1 with Windows. On Windows it works great, on both Ubuntu it doesn't.
mvn clean install generates in debug mode something like that: Could not transfer artifact junit:junit:pom:3.8.1 from/to central...: peer not authenticated stacktrace
I tried to use additional parameters mvn -Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true clean install
but it fails also. Output in debug mode ends with: Server key: Could not create EC public key: CKR_DOMAIN_PARAMS_INVALID
If I add all dependencies manually (copy&paste from my colleagues ~/.m2 directory) then mvn clean install works correctly. So, it seems to be a problem only with downloading.
Does anyone have any suggestions what can be wrong?
I found a solution for my problem. Be sure you have rights to write into {jdk_directory}/security/java.security file (in my case /etc/java-7-openjdk/security/java.security) and if so, then modify it this way:
from:
#security.provider.9=sun.security.ec.SunEC
security.provider.9=sun.security.pkcs11.SunPKCS11 ${java.home}/lib/security/nss.cfg
to
security.provider.9=sun.security.ec.SunEC
#security.provider.9=sun.security.pkcs11.SunPKCS11 ${java.home}/lib/security/nss.cfg
It fixed problem on all my computers (all with maven 3.0.4)

Forcing authentication on Maven release

I have a problem getting Maven to release to a Nexus server. Seemingly, it refuses to use my provided username and password (but there might be other problems as well).
When I first type 'mvn release:perform', I get a'not authorized'-error. However, some files are created on the Nexus, namely a pom with checksums etc. When I try a second time (without changing anything), I get a different error: '400 bad request'
When I delete the files and try again, I get the first error once again.
I have run this with the -X flag to see if I can make any sense of what is happening, and I have discovered that the first time I run the command, maven omits my username and password provided in settings.xml:
[INFO] [DEBUG] Using connector WagonRepositoryConnector with priority 0 for http://nexus.example.com/content/repositories/releases
When I run it the second time, it includes my credentials:
[INFO] [DEBUG] Using connector WagonRepositoryConnector with priority 0 for http://nexus.example.com/content/repositories/releases/ as developers
Notice it says 'as developers'
Of course I don't know that the fact that it prints it differently actually means anything, but it seems that way.
When I allow redeploy for the releases repository in Nexus, I always get the first variant (not authorized).
If anyone can tell me how I might force Maven to use my credentials (if that is indeed what it is not doing) or on what else might be wrong, I would be very happy.
I have got it working now, by specifying in the maven release plugin that it only deploy, and not deploy and deploy site as is default.
mvn site:deploy fails with the error: Wagon protocol 'http' does not support directory copying.
Of course, my original error message did not refer very much to site at all.
Way to produce useful error messages, Maven!
I found a way to force preemptive authentication here: http://maven.apache.org/guides/mini/guide-http-settings.html (it didn't solve my problem, but it is an answer to the title.)

Resources