Some little issues when starting with Maven2

Although I have been using Maven2 at several projects I was still having some problems to get it running after I installed it on a new (Windows) machine. After unzipping the file (which I downloaded here) I added Maven2 to the path environment variable. Next I added the environment variable ‘M2_HOME’ like this:

So that’s it. Now just check if Maven is running by entering the command ‘mvn -version’. But unfortunately I got the Java usage as a result:

I knew I had seen this before but I didn’t remember how I solved it back then. After double-checking all my settings in the path etc. I modified the M2_HOME variable value to:

Now when I ran the command ‘mvn -version’ I got:

And because I am posting about Maven anyway here is another tip:

When I ran Maven for the first time to compile a simple project with ‘mvn clean compile’ I got an error message:

The plugin ‘org.apache.maven.plugins:maven-resources-plugin’ does not exist or no valid version could be found

I would expect this error if I forgot to set my proxy or gave it the wrong configuration but that wasn’t the case. All I needed to do was to add the option ‘-U’ to force Maven2 to check the central repository for the plugin:


C:mvn_workspacetest-dcs2test-dcs2-ejb>mvn -U compile
[INFO] Scanning for projects…
[INFO] ————————————————————————-

[INFO] Building Unnamed – net.pascalalma.dcs2:test-dcs2-ejb:jar:0.0.1
[INFO] task-segment: [compile]
[INFO] ————————————————————————-

[INFO] artifact org.apache.maven.plugins:maven-resources-plugin: checking for updates from central
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-resources-plugin/2.2/maven-resources-plugin-2.2.pom
1K downloaded
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-plugins/1/maven-plugins-1.pom
3K downloaded
Downloading: http://repo1.maven.org/maven2/org/apache/maven/maven-parent/1/maven-parent-1.pom
6K downloaded
Downloading: http://repo1.maven.org/maven2/org/apache/apache/1/apache-1.pom
3K downloaded
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-resources-plugin/2.2/maven-resources-plugin-2.2.jar
13K downloaded
[INFO] artifact org.apache.maven.plugins:maven-compiler-plugin: checking for updates from central
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-compiler-plugin/2.0.2/maven-compiler-plugin-2.0.2.pom
2K downloaded
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-plugins/8/maven-plugins-8.pom
5K downloaded
Downloading: http://repo1.maven.org/maven2/org/apache/maven/maven-parent/5/maven-parent-5.pom
14K downloaded
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-compiler-plugin/2.0.2/maven-compiler-plugin-2.0.2.jar
17K downloaded
Downloading: http://repo1.maven.org/maven2/org/apache/maven/maven-model/2.0/maven-model-2.0.pom
2K downloaded
Downloading: http://repo1.maven.org/maven2/org/apache/maven/maven-project/2.0/maven-project-2.0.pom
1K downloaded
Downloading: http://repo1.maven.org/maven2/org/apache/maven/maven-profile/2.0/maven-profile-2.0.pom
1K downloaded
Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-container-default/1.0-alpha-8/plexus-container-default-1.0-alpha-8.pom
7K downloaded
Downloading: http://repo1.maven.org/maven2/junit/junit/3.8.1/junit-3.8.1.pom
998b downloaded
Downloading: http://repo1.maven.org/maven2/classworlds/classworlds/1.1-alpha-2/classworlds-1.1-alpha-2.pom
3K downloaded
Downloading: http://repo1.maven.org/maven2/org/apache/maven/maven-artifact-manager/2.0/maven-artifact-manager-2.0.pom
1K downloaded
Downloading: http://repo1.maven.org/maven2/org/apache/maven/maven-repository-metadata/2.0/maven-repository-metadata-2.0.pom
1K downloaded
Downloading: http://repo1.maven.org/maven2/org/apache/maven/maven-artifact/2.0/maven-artifact-2.0.pom
723b downloaded
Downloading: http://repo1.maven.org/maven2/org/apache/maven/wagon/wagon-provider-api/1.0-alpha-5/wagon-provider-api-1.0-alpha-5.pom
4K downloaded
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-compiler-m
anager/1.5.3/plexus-compiler-manager-1.5.3.pom
634b downloaded
Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-compiler/1
.5.3/plexus-compiler-1.5.3.pom
1K downloaded
Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-components
/1.1.6/plexus-components-1.1.6.pom
1K downloaded
Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus/1.0.8/plex
us-1.0.8.pom
7K downloaded
Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-compiler-a
pi/1.5.3/plexus-compiler-api-1.5.3.pom
624b downloaded
Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-compiler-j
avac/1.5.3/plexus-compiler-javac-1.5.3.pom
797b downloaded
Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-compilers/
1.5.3/plexus-compilers-1.5.3.pom
7K downloaded
Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-utils/1.0.
5/plexus-utils-1.0.5.pom
918b downloaded
Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-compiler-a
pi/1.5.3/plexus-compiler-api-1.5.3.jar
19K downloaded
Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-utils/1.0.
4/plexus-utils-1.0.4.jar
159K downloaded
Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-compiler-j
avac/1.5.3/plexus-compiler-javac-1.5.3.jar
13K downloaded
Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-compiler-m
anager/1.5.3/plexus-compiler-manager-1.5.3.jar
5K downloaded
[INFO] [compiler:compile]
[INFO] Nothing to compile – all classes are up to date
[INFO] ————————————————————————
[INFO] BUILD SUCCESSFUL
[INFO] ————————————————————————
[INFO] Total time: 26 seconds
[INFO] Finished at: Tue Oct 30 12:18:55 CET 2007
[INFO] Final Memory: 2M/5M
[INFO] ————————————————————————

I hope these issues help may help you when using Maven2, because I think every project should at least have a look at it.

About Pascal Alma

Pascal is a senior IT consultant and has been working in IT since 1997. He is monitoring the latest development in new technologies (Mobile, Cloud, Big Data) closely and particularly interested in Java open source tool stacks, cloud related technologies like AWS and mobile development like building iOS apps with Swift. Specialties: Java/JEE/Spring Amazon AWS API/REST Big Data Continuous Delivery Swift/iOS
This entry was posted in Maven and tagged . Bookmark the permalink.

3 Responses to Some little issues when starting with Maven2

  1. Du Huynh says:

    Thanks for your information ,do helpful !!!

  2. vitor (brazil) says:

    OH damn!!! dud, u save my life, i try million of things to fix this error and nothing, now readin’ this i build with sucess

    really thank

    Vitor from Brazil

  3. Alex says:

    Many thanks Pascal, you saved me a lot of time!

Comments are closed.