How to force Maven to download all test plugins without running any test? - maven

Problem:
We have an internal company Artifactory server for our Maven dependencies. We have a dedicated Maven project with test cases and some of our internal libraries are used in this project. The Artifactory server is reachable from our CI so all the artifacts can be pulled during build process.
Our goal is to run the tests from that project in Docker container in a private cluster without access to internal repository - for practical purposes, we can assume that mvn test is invoked offline.
That means that as part of the build process, I want to package test project and all required dependencies into an Docker image so that I can run tests safely in offline environment without need to pull anything.
My approach:
The current approach is to make sure that .m2 repo is part of the image and then invoke this command in Dockerfile:
mvn clean install -DskipTests
The command downloads many Maven plugins (so that they are in .m2/repository now).
Then in the test environment I invoke:
mvn test -o
However, the latter command produces error when running the container:
[INFO] Scanning for projects...
(...)
[INFO]
[INFO] Building test-project 1.0.0
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # test-project ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /workspace/test-project/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # test-project ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # test-project ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # test-project ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.22.2:test (default-test) # test-project ---
[WARNING] Missing POM for org.apache.maven.surefire:surefire-junit-platform:jar:2.22.2
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.908 s
[INFO] Finished at: 2019-12-12T07:43:40Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.2:test (default-test) on project test-project: Unable to generate classpath: org.apache.maven.artifact.resolver.MultipleArtifactsNotFoundException: Missing:
[ERROR] ----------
[ERROR] 1) org.apache.maven.surefire:surefire-junit-platform:jar:2.22.2
[ERROR]
[ERROR] Try downloading the file manually from the project website.
[ERROR]
[ERROR] Then, install it using the command:
[ERROR] mvn install:install-file -DgroupId=org.apache.maven.surefire -DartifactId=surefire-junit-platform -Dversion=2.22.2 -Dpackaging=jar -Dfile=/path/to/file
[ERROR]
[ERROR] Alternatively, if you host your own repository you can deploy the file there:
[ERROR] mvn deploy:deploy-file -DgroupId=org.apache.maven.surefire -DartifactId=surefire-junit-platform -Dversion=2.22.2 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
[ERROR]
[ERROR] Path to dependency:
[ERROR] 1) dummy:dummy:jar:1.0
[ERROR] 2) org.apache.maven.surefire:surefire-junit-platform:jar:2.22.2
[ERROR]
[ERROR] ----------
[ERROR] 1 required artifact is missing.
[ERROR]
[ERROR] for artifact:
[ERROR] dummy:dummy:jar:1.0
[ERROR]
[ERROR] from the specified remote repositories:
[ERROR] central (http://company-repo.org/artifactory/plugins-release, releases=true, snapshots=false),
[ERROR] snapshots (http://company-repo.org.org/artifactory/plugins-snapshot, releases=true, snapshots=true)
[ERROR]
[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/MojoExecutionException
I'm not sure if dummy.jar is part of my project setup but I think that error can be ignored.
It seems to me that org.apache.maven.surefire:surefire-junit-platform plugin is not available. And when I looked at the build command output I confirmed that it succeeds without ever invoking this plugin (and so without ever pulling it to local repository):
mvn clean install -DskipTests
(...)
[INFO] --- maven-surefire-plugin:2.22.2:test (default-test) # test-project ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) # test-project ---
(...)
So the problem is: how do I prepare Maven to run tests in "offline" mode without actually running the tests?
I could run all the tests in the build command, but it would waste a lot of time and results are useless anyway (tests only produce meaningful results in isolated cluster)
I tried to use option -Dtest with "match-nothing" pattern but the plugin wasn't pulled (apparently it activates only if there are some tests to run)
I tried mvn dependency:go-offline which pulled in hundreds of dependencies but not those for test
I could add explicit dependency to all test plugins in my pom.xml but it would become maintenance burden (difficult version upgrade, possibly multiple plugins required etc.)

Have a look to https://github.com/qaware/go-offline-maven-plugin, maybe it can help. It has been developed to fix some issues of the maven-dependency-plugin.

Related

Building Gluon Apps in Multi-Module Project

TL;DR: How does one build a Gluon app that's part of a larger multi-module project?
I have a multi-module Mave project (that is, my top-level POM has "<packaging>pom</packaging>"). The project contains a bunch of libraries and related sub-projects, one of which is a Gluon app that will be what my actual users install. (The rest of the project is all the cloud-hosted plumbing that the client app connects to.)
When I try to build the Gluon app, per the Gluon documentation, I am getting the following error:
mvn gluonfx:build
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] app [pom]
[INFO] app-common [jar]
[INFO] app-server [jar]
[INFO] app-client [jar]
[INFO] app-test [jar]
[INFO] app-utilities [jar]
[INFO] app-integration-lambda [jar]
[INFO] app-integration-jakarta [war]
[INFO] app-gluon [jar]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for app 0.9:
[INFO]
[INFO] app ............................................ SKIPPED
[INFO] app-common ..................................... SKIPPED
[INFO] app-server ..................................... SKIPPED
[INFO] app-client ..................................... SKIPPED
[INFO] app-test ....................................... SKIPPED
[INFO] app-utilities .................................. SKIPPED
[INFO] app-integration-lambda ......................... SKIPPED
[INFO] app-integration-jakarta ........................ SKIPPED
[INFO] app-gluon ...................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.298 s
[INFO] Finished at: 2022-02-22T21:03:18+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] No plugin found for prefix 'gluonfx' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (C:\Users\Administrator\.m2\repository), central (https://repo.maven.apache.org/maven2)] -> [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/NoPluginFoundForPrefixException
If I run Maven so that it only builds the Gluon application instead, like this:
mvn gluonfx:build --projects "app-gluon" --also-make
I get basically the same error. If I cd to app-gluon first, I get a different error (and I didn't expect this to work anyhow):
cd app-gluon
mvn gluonfx:build
[INFO] Scanning for projects...
[INFO]
[INFO] --------------------< com.whatever:app-gluon >--------------------
[INFO] Building app-gluon 0.9
[INFO] --------------------------------[ jar ]---------------------------------
[WARNING] The POM for com.whatever:app-common:jar:0.9 is missing, no dependency information available
[WARNING] The POM for com.whatever:app-client:jar:0.9 is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.380 s
[INFO] Finished at: 2022-02-22T21:09:12+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project app-gluon: Could not resolve dependencies for project com.whatever:app-gluon:jar:0.9: The following artifacts could not be
resolved: com.whatever:app-common:jar:0.9, com.whatever:app-client:jar:0.9: com.whatever:app-common:jar:0.9 was not found in https://nexus.gluonhq.com/nexus/
content/repositories/releases during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of Gluon has elapsed or updates are forced -> [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
So my question is: how does one build a Gluon app that's part of a larger multi-module project?
If you have a multi module project, and your app module depends on other modules, you need to publish those modules to a repository, so the app module finds them, like any other third party dependency.
Typically, for local development, you can simply use mvn install from the root folder to deploy your project locally. Of course, for distribution, you should consider publishing them to a reachable repository.
Make sure all your modules are deployed to your ~/.m2 repository.
Then you can run from the root:
mvn gluonfx:build -f app-gluon
or enter in the app-gluon folder:
cd app-gluon
mvn gluonfx:build
And remember that every time you make any change to the other modules, you will need to publish them again before building the native image.
Also, since you can run your app on the JVM, before building the native image (which takes a couple of minutes), you can simply run and test:
mvn gluonfx:run
and if that works fine, do the native image build.

JBoss Fuse 6.3, Maven and settings.xml

I'm trying to follow Red Hat JBoss Fuse-6.3 Developer Guide. I added everything to the Windows: Documents and Settings\User\.m2\settings.xml (which didnt exist) as per the document.The build command I'm using is
C:\Apps\apache-maven-3.5.0\bin\mvn archetype:generate -DarchetypeGroupId=io.fabric8.archetypes -DarchetypeArtifactId=karaf-soap-archetype -DarchetypeVersion=1.2.0.redhat-630187 -DgroupId=org.fusesource.example -DartifactId=cxf-basic -Dversion=1.0-SNAPSHOT -Dfabric8-profile=cxf-basic-profile
I'm now getting this error:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> maven-archetype-plugin:3.0.1:generate (default-cli) > generate-sources # standalone-pom >>>
[INFO]
[INFO] <<< maven-archetype-plugin:3.0.1:generate (default-cli) < generate-sources # standalone-pom <<<
[INFO]
[INFO]
[INFO] --- maven-archetype-plugin:3.0.1:generate (default-cli) # standalone-pom ---
[INFO] Generating project in Interactive mode
[INFO] Archetype repository not defined. Using the one from [io.fabric8.archetypes:karaf-soap-archetype:1.2.0.redhat-133] found in catalog remote
[WARNING] The POM for io.fabric8.archetypes:karaf-soap-archetype:jar:1.2.0.redhat-630187 is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.056 s
[INFO] Finished at: 2018-01-17T10:31:19-07:00
[INFO] Final Memory: 12M/54M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:3.0.1:generate (default-cli) on project standalone-pom: The desired archetype does not exist (io.fabric8.archetypes:karaf-soap-archetype:1.2.0.redhat-630187) -> [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
C:\P\Projects\JBoss_Dev_Studio-10.1.0.GA_SideProjects\get-started>
I do see that archetype exists.
Googling around for archetype does not exist (io.fabric8.archetypes:karaf-soap-archetype:1.2.0.redhat-630187 and yes! It's one of those 0 results found!
The key turned out to be this
[INFO] Archetype repository not defined. Using the one from [io.fabric8.archetypes:karaf-soap-archetype:1.2.0.redhat-133] found in catalog remote
[WARNING] The POM for io.fabric8.archetypes:karaf-soap-archetype:jar:1.2.0.redhat-630187 is missing, no dependency information available
And me being a bit of a newb with Maven - I didnt understand it first. I then googled a bit more for settings.xml - I then found mention of a settings.xml also contained in C:\Apps\apache-maven-3.5.0\conf
I added the Red Hat repositories to that file instead (as it was completely empty) and everything now builds properly. Hopefully this might help someone else figure out a similar problem faster than I did whether it's with regards to jboss fuse or maven not being correctly setup,

Apache Quickstart not working: "The defined artifact is not an archetype"

I'm trying to get started with the basic Flink quickstart examples.
https://ci.apache.org/projects/flink/flink-docs-release-1.2/quickstart/java_api_quickstart.html
I'm getting an error at the very first step with Maven. Regardless of whether I try to install using Maven or the "curl" command, I get the same error "The defined artifact is not an archetype":
Command:
mvn archetype:generate \
> -DarchetypeGroupId=org.apache.flink \
> -DarchetypeArtifactId=flink-quickstart-java \
> -DarchetypeVersion=1.2.0
Response:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> maven-archetype-plugin:3.0.1:generate (default-cli) > generate-sources # standalone-pom >>>
[INFO]
[INFO] <<< maven-archetype-plugin:3.0.1:generate (default-cli) < generate-sources # standalone-pom <<<
[INFO]
[INFO] --- maven-archetype-plugin:3.0.1:generate (default-cli) # standalone-pom ---
[INFO] Generating project in Interactive mode
[INFO] Archetype repository not defined. Using the one from [org.apache.flink:flink-quickstart-java:1.2.1] found in catalog remote
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.916 s
[INFO] Finished at: 2017-05-03T18:16:55+02:00
[INFO] Final Memory: 18M/280M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:3.0.1:generate (default-cli) on project standalone-pom: The defined artifact is not an archetype -> [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'm very confused as I was able to execute these quickstarts last week without problem, and I'm completely new to Maven/Flink so I'm having trouble pinpointing what could have changed since then. Any ideas?
Only defining the archetype is not enough. You also need to provide details for the current maven project itself.
Either you have to pass the 'groupId', 'artifactId' and 'version' in the interactive mode when you run the above mentioned command.
Or, you can use the following command mvn archetype:generate -DarchetypeGroupId=org.apache.flink -DarchetypeArtifactId=flink-quickstart-java -DarchetypeVersion=1.2.0 -DgroupId=com.example -DartifactId=flink -Dversion=0.1
I have encountered with a similar error while I was trying to generate the "graphwalker" archetype using below command.
mvn archetype:generate -B \
-DarchetypeGroupId=org.graphwalker \
-DarchetypeArtifactId=graphwalker-maven-archetype \
-DgroupId=com.company -DartifactId=myProject \
-DarchetypeVersion=LATEST
However, my clue was I could generate it in the first time, but the second time it threw a similar error.
I was able to solve it by removing ./m2/repository and generating the archetype again.
rm -rf ./m2/repository

no dependency infomation available when building a project throung maven

Project source: https://github.com/parallaxinc/BlocklyProp
I'm trying to deploy it to a local server. after I cloned it and run "mvn package", error occurs.
root#ubuntu:/home/tinywind/BlocklyProp-master# mvn package
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building BlocklyProp 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for com.parallax.client:Cloud-Session-java-client:jar:1.0-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for com.parallax.client:Cloud-Compiler-java-client:jar:1.0-SNAPSHOT is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.946 s
[INFO] Finished at: 2017-02-23T17:55:12-08:00
[INFO] Final Memory: 9M/31M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project BlocklyProp: Could not resolve dependencies for project com.parallax:BlocklyProp:war:1.0-SNAPSHOT: The following artifacts could not be resolved: com.parallax.client:Cloud-Session-java-client:jar:1.0-SNAPSHOT, com.parallax.client:Cloud-Compiler-java-client:jar:1.0-SNAPSHOT: Failure to find com.parallax.client:Cloud-Session-java-client:jar:1.0-SNAPSHOT in http://bits.netbeans.org/maven2/ was cached in the local repository, resolution will not be reattempted until the update interval of netbeans.maven2.repository has elapsed or updates are forced -> [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
Is there any solution or suggestion, I am a PHP developer, this is my first time to deploy a java application to server.

maven error BUILD FAILURE

I am following a maven tutorial. I am trying to execute this command which is my 1st maven command. Tutorial says it will crate a directory named my-app, but it didn't. This is command & its output,
command:
mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
output:
C:\Users\Babar>mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=m
y-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> maven-archetype-plugin:2.1:generate (default-cli) # standalone-pom >>
>
[INFO]
[INFO] <<< maven-archetype-plugin:2.1:generate (default-cli) # standalone-pom <<
<
[INFO]
[INFO] --- maven-archetype-plugin:2.1:generate (default-cli) # standalone-pom --
-
[INFO] Generating project in Batch mode
[INFO] -------------------------------------------------------------------------
---
[INFO] Using following parameters for creating project from Old (1.x) Archetype:
maven-archetype-quickstart:1.0
[INFO] -------------------------------------------------------------------------
---
[INFO] Parameter: groupId, Value: com.mycompany.app
[INFO] Parameter: packageName, Value: com.mycompany.app
[INFO] Parameter: package, Value: com.mycompany.app
[INFO] Parameter: artifactId, Value: my-app
[INFO] Parameter: basedir, Value: C:\Users\Babar
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 22.971s
[INFO] Finished at: Fri Nov 18 00:07:12 EET 2011
[INFO] Final Memory: 6M/11M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2
.1:generate (default-cli) on project standalone-pom: Directory my-app already ex
ists - please run from a clean directory -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[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 rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureExc
eption
'cmd' is not recognized as an internal or external command,
operable program or batch file.
error msg says directory already exists but it's not. I execute this command more than oncw
EDIT
command(suggested in answer)
mvn archetype:generate -DarchetypeGroupId=org.apache.maven.archet
ypes -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=5-SNAPS
HOT
OUTPUT
C:\Users\Babar>mvn archetype:generate -DarchetypeGroupId=org.apache.maven.archet
ypes -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=5-SNAPS
HOT
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> maven-archetype-plugin:2.1:generate (default-cli) # standalone-pom >>
>
[INFO]
[INFO] <<< maven-archetype-plugin:2.1:generate (default-cli) # standalone-pom <<
<
[INFO]
[INFO] --- maven-archetype-plugin:2.1:generate (default-cli) # standalone-pom --
-
[INFO] Generating project in Interactive mode
[INFO] Archetype repository missing. Using the one from [org.apache.maven.archet
ypes:maven-archetype-quickstart:1.1] found in catalog remote
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.552s
[INFO] Finished at: Fri Nov 18 01:09:15 EET 2011
[INFO] Final Memory: 6M/12M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2
.1:generate (default-cli) on project standalone-pom: The desired archetype does
not exist (org.apache.maven.archetypes:maven-archetype-quickstart:5-SNAPSHOT) ->
[Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[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 rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureExc
eption
'cmd' is not recognized as an internal or external command,
operable program or batch file.
Close your eclipse
Delete the .m2 folder which shows the server connnection
Re-run your eclipse.
Try this one, it works for maven 3-3-9 for win7 32bit
mvn archetype:generate -DgroupId="com.mycompany.app" -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
Try this :
mvn archetype:generate -DgroupId="com.mycompany.app" -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
Your sentences have been modified -DgroupId="com.mycompany.app". You need to use double quotes.
I´ve worked on windows 8 and it works. I don´t know if it happens on Linux.
I faced the same issue, and I resolved by run the commond(MVN Clean) from inside the folder where pom.xml located. Please follow below steps:
Open Eclipse
Open your Maven project.
Right Click on pom.xml
Click on properties
5.Copy pom.xml location URL
Open cmd
Write and paste the pom.xml location in the cmd until before /pom.xml as below,
cd C:\Users\X\eclipse-workspace\Your project Name
Hit Enter.
Run mvn clean commond again.
You will note that the original error said
Directory my-app already exists - please run from a clean directory
Did you possibly run that command from a directory where there is already a Maven project (one with a pom.xml file)? If so please start with a clean location.
When I ran the command you used verbatim on an empty directory, it ran without error and created a directory called my-app.
This line is of concern:
[INFO] Using following parameters for creating project from Old (1.x)
Archetype: maven-archetype-quickstart:1.0
Looking at the maven docs page at http://maven.apache.org/archetype/maven-archetype-bundles/maven-archetype-quickstart/, i see that the command you should be using is:
mvn archetype:generate -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=5-SNAPSHOT
Which is not exactly what you are running (you are missing the -DarchetypeVersion=5-SNAPSHOT part).

Resources