How to run mvn verify in a maven-download disabled box? - java

I need to run mvn verify in a secured box where maven is not able to download anything. I am able to run the command on my local laptop, so I copied my local .m2 folder to the secured box. However, I got this error:
$ mvn verify -o
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building <Masked strings>
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.109s
[INFO] Finished at: Wed May 07 20:49:26 UTC 2014
[INFO] Final Memory: 10M/232M
[INFO] ------------------------------------------------------------------------
[ERROR] 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: The repository system is offline but the artifact org.apache.maven.plugins:maven-plugins:pom:19 is not available in the local repository. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[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/PluginResolutionException
So, looks like copying .m2 is not enough. So, what should I do to make sure maven can do the job without downloading anything?
Thank you very much.

Related

error with :maven-clean-plugin:2.5 or one of its dependencies could not be resolved

Trying to run a program with maven and keep getting this error any ideas on how to fix? ps- I'm a complete newbie with maven/tomcat/springframework etc
ebitnami#ubuntu:~$ cd OpenESPI-Common-java/
bitnami#ubuntu:~/OpenESPI-Common-java$ mvn -Dmaven.test.skip=true clean install
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Common 1.3-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-
plugin/2.5/maven-clean-plugin-2.5.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.809s
[INFO] Finished at: Wed Jun 17 16:21:44 EDT 2020
[INFO] Final Memory: 6M/59M
[INFO] ------------------------------------------------------------------------
[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 (http://repo.maven.apache.org/maven2): Failed to transfer file:
http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-
plugin-2.5.pom. Return code is: 501 , ReasonPhrase:HTTPS Required. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[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/PluginResolutionException

Maven : Not able to download dependencies jta:1.0.1B

I'm receiving following error when I run mvn clean install.
Error says not able to resolve dependencies javax.transaction:jta:jar:1.0.1B
Please note that I'm not refering to javax.transaction:jta:jar:1.0.1B in my pom. May be this dependency is refered by some other dependency that I mentioned in my pom.
Please find the error below
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building sample-webapp Maven Webapp 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: https://repo.maven.apache.org/maven2/javax/transaction/jta/1.0.1B/jta-1.0.1B.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.810 s
[INFO] Finished at: 2016-12-05T08:43:47+05:30
[INFO] Final Memory: 12M/309M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project sample-webapp: Could not resolve dependencies for project com.ganesh:sample-webapp:war:1.0-SNAPSHOT: Could not find artifact ja
vax.transaction:jta:jar:1.0.1B in central (https://repo.maven.apache.org/maven2), try downloading from http://java.sun.com/products/jta -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[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
that's a legacy library that is not available from Maven Central.
It isn't available because there are still some old Sun-era Javax JARS that are not covered under open source licenses. If you need to access this JTA 1.0.1B library, you will need to replace that dependency using an exclusion.
note: and when I hit this url https://repo.maven.apache.org/maven2/javax/transaction/jta/1.0.1B/jta-1.0.1B.jar in the browser, it return to 404 Not Found then I dont know why you can dowload it.
for more info Why can't I download the javax.transaction:jta:1.0.1B JAR?

MAVEN SUREFIRE PLUGIN ERROR

Im building a custom maven project for jenkins. After using the command
mvn -Plight-test install
I recieve this error .Please help. I have also added the plugin for surefire exception in the pom.xml file, but it isn't working! The error log is as follows :
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Jenkins main module ................................ SUCCESS [ 11.809 s]
[INFO] Jenkins cli ........................................ SUCCESS [ 38.319 s]
[INFO] Jenkins core ....................................... FAILURE [11:15 min]
[INFO] Jenkins war ........................................ SKIPPED
[INFO] Tests for Jenkins core ............................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 12:10 min
[INFO] Finished at: 2016-05-05T12:26:54+05:30
[INFO] Final Memory: 39M/277M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test (default-test) on project jenkins-core:
.
[ERROR]
[ERROR] Please refer to C:\Users\Anishas\git\jenkins\core\target\surefire-reports for the individual test results.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[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/MojoFailureException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :jenkins-core
Compile :
I had the same issues and I found out that the problem was that some of tests tried to create a System link and it was not possible because I didn't start my IDE (IntellijIdea) as administrator in Windows.
I started Intellij as administrator and that solved the problem.
Skipping test is not a good practice when developing.
mvn -Dmaven.test.skip=true -DskipTests=true clean install
use this command
Rerun with mvn -Plight-test install -rf jenkins-core -X to isolate the error

Maven 3: Maven in 5 minutes "mvn archetype:generate..." command NOT WORKING

I installed Maven 3.1.1 for the first time. In the "Maven in 5 Minutes" getting-started guide
http://maven.apache.org/guides/getting-started/maven-in-five-minutes.html
it says to verify the installation with
mvn --version
I got the expected response:
Apache Maven 3.1.1 (0728685237757ffbf44136acec0402957f723d9a; 2013-09-17 11:22:22-0400)
Maven home: C:\applications\programming\apache-maven-3.1.1
Java version: 1.6.0_17, vendor: Sun Microsystems Inc.
Java home: C:\applications\programming\java_6_17\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "x86", family: "windows"
In the next step, under "Creating a project" it says to create a new directory, open a command prompt in that directory, and execute
mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
I created a directory called xjmaven, ran the command in it, and it's not working. This is the response:
[R:\jeffy\programming\sandbox\xjmaven]mvn archetype:generate -DgroupId=xbnjava -DartifactId=XBN-Java -Darchetype ArtifactId=maven-archetype-quickstart -DinteractiveMode=false
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.251s
[INFO] Finished at: Sat Nov 23 12:11:56 EST 2013
[INFO] Final Memory: 2M/4M
[INFO] ------------------------------------------------------------------------
[ERROR] The goal you specified requires a project to execute but there is no POM in this directory (R:\jeffy\programming\sandbox\xjmaven). Please verify you invoked Maven from the correct directory. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[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/MissingProjectException
I looked up the parameters groupId, artifactId and archetypeArtifactId, and have tried some different values (as you can see above), but I still get the same BUILD FAILURE response.
I manually put the pom.xml file (from in the same webpage) in the xjmaven directory, and ran it again. It downloaded a bunch of stuff (although not to xjmaven), but then failed with this message:
[INFO] Generating project in Interactive mode
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/archetypes/true/1.0/true-1.0.jar
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Skipping Maven Quick Start Archetype
[INFO] This project has been banned from the build due to previous failures.
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 45.047s
[INFO] Finished at: Sat Nov 23 12:04:01 EST 2013
[INFO] Final Memory: 7M/17M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.2:generate (default-cli) on project XBN-Java: The desired archetype does not exist (org.apache.maven.archetypes:true:1.0) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[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/MojoFailureException
Repeating the command gives this response:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Quick Start Archetype 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> maven-archetype-plugin:2.2:generate (default-cli) # XBN-Java >>>
[INFO]
[INFO] <<< maven-archetype-plugin:2.2:generate (default-cli) # XBN-Java <<<
[INFO]
[INFO] --- maven-archetype-plugin:2.2:generate (default-cli) # XBN-Java ---
[INFO] Generating project in Interactive mode
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Skipping Maven Quick Start Archetype
[INFO] This project has been banned from the build due to previous failures.
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.444s
[INFO] Finished at: Sat Nov 23 12:04:32 EST 2013
[INFO] Final Memory: 8M/14M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.2:generate (default-cli) on project XBN-Java: The desired archetype does not exist (org.apache.maven.archetypes:true:1.0) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[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/MojoFailureException
I deleted pom.xml (it's the only file in the directory...the stuff it downloaded is not there), and started over again. Everything happens (badly) as I write above.
I remember trying Maven a few years ago, and could also not get past the getting-started stage.
If anyone has some advice on how to get past this, it would be appreciated. Really frustrated.
Maybe you are using Windows PowerShell?
If so, you'll need to put quotes around the parameter definitions:
mvn archetype:generate "-DarchetypeGroupId=org.apache.maven.archetypes" "-DgroupId=com.mycompany.app" "-DartifactId=my-app"
You have some syntactical errors while executing the generate goal. Moreover, you need not create the pom.xml or any dir sturcture. You will notice that the generate goal creates a directory with the same name given as the artifactId.
e.g. you are missing the convention like -DgroupId should be com.company.app (not a big issue though), having space in -Darchetype ArtifactId, etc.
I just tried below and it worked :
mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
I was having a similar issue on powershell. I switched to command prompt and executed the same command and it works fine. Command that works on command prompt: mvn archetype:generate -DgroupId=com.myapp-DartifactId=hellomaven -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
The one that runs on powershell:
mvn archetype:generate "-DarchetypeGroupId=org.apache.maven.archetypes" "-DgroupId=com.myapp" "-DartifactId=my-app"

error BUILD FAILURE in creating maven project

I want to create a project by execute this command:
mvn archetype:generate -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.1 -DgroupId=org.geoserver -DartifactId=hello -Dversion=1.0 -DinteractiveMode=false
and this error is:
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.122s
[INFO] Finished at: Tue Mar 26 18:00:21 IRDT 2013
[INFO] Final Memory: 4M/75M
[INFO] ------------------------------------------------------------------------
[ERROR] The goal you specified requires a project to execute but there is no POM in this directory (C:\Users\Iman). Please verify you invoked Maven from the correct directory. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[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/MissingProjectException`
what can i do?
If you use the command
mvn archetype:generate -DarchetypeGroupId="Name of group ID" -DgroupId="group id here" -DartifactId="put artifact id here"
It should work. I've never seen the -DinteractiveMode command before and it will generally ask you for a version number in the set up.

Categories

Resources