How do I update my Maven project to work in Eclipse?
Author: Deron Eriksson
Description: This tutorial describes how to update a project with the maven eclipse:eclipse goal.
Tutorial created using:
Windows Vista || JDK 1.6.0_04 || Eclipse Web Tools Platform 2.0.1 (Eclipse 3.3.1)
(Continued from page 1) As a comparison, here is the .classpath file before we ran eclipse:eclipse. .classpath before eclipse:eclipse<?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry kind="src" path="src/main/java"/> <classpathentry kind="src" path="src/test/java"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="output" path="bin"/> </classpath> Here is the .classpath file after eclipse:eclipse. .classpath before eclipse:eclipse<classpath> <classpathentry kind="src" path="src/main/java"/> <classpathentry kind="src" path="src/test/java" output="target/test-classes"/> <classpathentry kind="output" path="target/classes"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar"/> </classpath> We can see that the mavenSW eclipseSW plugin added the junit jarW file in the local maven repository to the .classpath file (using the M2_REPO classpathW variable). The project now builds correctly in Eclipse! In case you're interested, here is the console output from the eclipse:eclipse goal. eclipse:eclipse console output[INFO] Scanning for projects... [INFO] Searching repository for plugin with prefix: 'eclipse'. [INFO] artifact org.apache.maven.plugins:maven-eclipse-plugin: checking for updates from central Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-eclipse-plugin/2.4/maven-eclipse-plugin-2.4.pom 3/5K 5/5K 5K downloaded Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-plugins/8/maven-plugins-8.pom 3/5K 5/5K 5K downloaded Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-eclipse-plugin/2.4/maven-eclipse-plugin-2.4.jar 4/125K 7/125K 11/125K 15/125K 17/125K 21/125K 22/125K 26/125K 30/125K 32/125K 36/125K 40/125K 44/125K 48/125K 52/125K 56/125K 56/125K 59/125K 63/125K 67/125K 69/125K 73/125K 77/125K 81/125K 84/125K 88/125K 92/125K 95/125K 99/125K 100/125K 104/125K 108/125K 112/125K 115/125K 118/125K 122/125K 125/125K 125K downloaded [INFO] ------------------------------------------------------------------------ [INFO] Building mytest [INFO] task-segment: [eclipse:eclipse] [INFO] ------------------------------------------------------------------------ [INFO] Preparing eclipse:eclipse [INFO] No goals needed for project - skipping Downloading: http://repo1.maven.org/maven2/org/apache/maven/maven-artifact/2.0.6/maven-artifact-2.0.6.pom 1/1K 1K downloaded Downloading: http://repo1.maven.org/maven2/org/apache/maven/maven/2.0.6/maven-2.0.6.pom 3/8K 7/8K 8/8K 8K downloaded [WARNING] *** CHECKSUM FAILED - Checksum failed on download: local = '1991be0ed3e1820e135201406d5acabf8c08d426'; remote = '218016709d90d14b64bfb1de3a86a2247e8873db' - RETRYING Downloading: http://repo1.maven.org/maven2/org/apache/maven/maven/2.0.6/maven-2.0.6.pom 3/8K 7/8K 8/8K 8K downloaded [WARNING] *** CHECKSUM FAILED - Checksum failed on download: local = '1991be0ed3e1820e135201406d5acabf8c08d426'; remote = '218016709d90d14b64bfb1de3a86a2247e8873db' - IGNORING Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-utils/1.4.1/plexus-utils-1.4.1.pom 1/1K 1K downloaded Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus/1.0.11/plexus-1.0.11.pom 3/8K 7/8K 8/8K 8K downloaded Downloading: http://repo1.maven.org/maven2/org/apache/maven/maven-project/2.0.6/maven-project-2.0.6.pom 2/2K 2K downloaded Downloading: http://repo1.maven.org/maven2/org/apache/maven/maven-settings/2.0.6/maven-settings-2.0.6.pom 1/1K 1K downloaded Downloading: http://repo1.maven.org/maven2/org/apache/maven/maven-model/2.0.6/maven-model-2.0.6.pom 2/2K 2K downloaded Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-container-default/1.0-alpha-9-stable-1/plexus-container-default-1.0-alpha-9-stable-1.pom 3/3K 3K downloaded Downloading: http://repo1.maven.org/maven2/org/apache/maven/maven-profile/2.0.6/maven-profile-2.0.6.pom 1/1K 1K downloaded Downloading: http://repo1.maven.org/maven2/org/apache/maven/maven-artifact-manager/2.0.6/maven-artifact-manager-2.0.6.pom 2/2K 2K downloaded Downloading: http://repo1.maven.org/maven2/org/apache/maven/maven-repository-metadata/2.0.6/maven-repository-metadata-2.0.6.pom 1/1K 1K downloaded Downloading: http://repo1.maven.org/maven2/org/apache/maven/wagon/wagon-provider-api/1.0-beta-2/wagon-provider-api-1.0-beta-2.pom 680/680b 680b downloaded Downloading: http://repo1.maven.org/maven2/org/apache/maven/wagon/wagon/1.0-beta-2/wagon-1.0-beta-2.pom 4/5K 5/5K 5K downloaded Downloading: http://repo1.maven.org/maven2/org/apache/maven/maven-plugin-registry/2.0.6/maven-plugin-registry-2.0.6.pom 1/1K 1K downloaded Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-archiver/1.0-alpha-7/plexus-archiver-1.0-alpha-7.pom 1/1K 1K downloaded Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-components/1.1.6/plexus-components-1.1.6.pom 1/1K 1K downloaded Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus/1.0.8/plexus-1.0.8.pom 4/7K 7/7K 7K downloaded Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-utils/1.2/plexus-utils-1.2.pom 767/767b 767b downloaded Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus/1.0.5/plexus-1.0.5.pom 3/5K 5/5K 5K downloaded Downloading: http://repo1.maven.org/maven2/biz/aQute/bndlib/0.0.145/bndlib-0.0.145.pom 886/886b 886b downloaded Downloading: http://repo1.maven.org/maven2/org/apache/maven/maven-archiver/2.2/maven-archiver-2.2.pom 1/1K 1K downloaded Downloading: http://repo1.maven.org/maven2/org/apache/maven/shared/maven-shared-components/3/maven-shared-components-3.pom 1/1K 1K downloaded Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-utils/1.4.2/plexus-utils-1.4.2.pom 1/1K 1K downloaded Downloading: http://repo1.maven.org/maven2/org/apache/maven/maven-plugin-api/2.0.6/maven-plugin-api-2.0.6.pom 1/1K 1K downloaded Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-interactivity-jline/1.0-alpha-5/plexus-interactivity-jline-1.0-alpha-5.pom 772/772b 772b downloaded Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-interactivity/1.0-alpha-5/plexus-interactivity-1.0-alpha-5.pom 482/482b 482b downloaded Downloading: http://repo1.maven.org/maven2/jline/jline/0.9.1/jline-0.9.1.pom 145/145b 145b downloaded Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-interactivity-api/1.0-alpha-5/plexus-interactivity-api-1.0-alpha-5.pom 430/430b 430b downloaded Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-utils/1.4.2/plexus-utils-1.4.2.jar 3/185K 7/185K 11/185K 11/185K 15/185K 17/185K 21/185K 22/185K 26/185K 30/185K 32/185K 36/185K 40/185K 44/185K 44/185K 48/185K 52/185K 52/185K 56/185K 59/185K 63/185K 67/185K 69/185K 73/185K 77/185K 81/185K 84/185K 88/185K 92/185K 95/185K 99/185K 100/185K 104/185K 108/185K 112/185K 115/185K 118/185K 122/185K 126/185K 129/185K 133/185K 137/185K 137/185K 141/185K 145/185K 149/185K 153/185K 154/185K 158/185K 162/185K 165/185K 169/185K 173/185K 176/185K 180/185K 184/185K 185/185K 185K downloaded Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-archiver/1.0-alpha-7/plexus-archiver-1.0-alpha-7.jar 4/138K 7/138K 11/138K 15/138K 17/138K 21/138K 22/138K 26/138K 30/138K 32/138K 36/138K 40/138K 44/138K 48/138K 52/138K 56/138K 56/138K 60/138K 64/138K 68/138K 69/138K 73/138K 77/138K 81/138K 84/138K 88/138K 92/138K 96/138K 98/138K 101/138K 105/138K 109/138K 112/138K 116/138K 120/138K 120/138K 124/138K 128/138K 132/138K 136/138K 138/138K 138K downloaded Downloading: http://repo1.maven.org/maven2/biz/aQute/bndlib/0.0.145/bndlib-0.0.145.jar 3/111K 7/111K 11/111K 11/111K 15/111K 17/111K 21/111K 22/111K 26/111K 30/111K 32/111K 36/111K 40/111K 44/111K 44/111K 47/111K 51/111K 55/111K 58/111K 61/111K 65/111K 69/111K 73/111K 75/111K 79/111K 83/111K 87/111K 91/111K 95/111K 96/111K 100/111K 104/111K 108/111K 111/111K 111K downloaded Downloading: http://repo1.maven.org/maven2/org/apache/maven/maven-archiver/2.2/maven-archiver-2.2.jar 3/9K 7/9K 9/9K 9K downloaded Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-interactivity-jline/1.0-alpha-5/plexus-interactivity-jline-1.0-alpha-5.jar 4/5K 5/5K 5K downloaded Downloading: http://repo1.maven.org/maven2/jline/jline/0.9.1/jline-0.9.1.jar 3/45K 7/45K 11/45K 15/45K 17/45K 21/45K 22/45K 26/45K 30/45K 32/45K 36/45K 40/45K 44/45K 45/45K 45K downloaded [INFO] [eclipse:eclipse] Downloading: http://repo1.maven.org/maven2/junit/junit/3.8.1/junit-3.8.1.jar 4/118K 7/118K 11/118K 15/118K 17/118K 21/118K 22/118K 26/118K 30/118K 32/118K 36/118K 40/118K 44/118K 48/118K 52/118K 52/118K 56/118K 59/118K 63/118K 67/118K 71/118K 72/118K 76/118K 79/118K 83/118K 87/118K 90/118K 92/118K 96/118K 100/118K 104/118K 107/118K 111/118K 115/118K 118/118K 118K downloaded [INFO] Using source status cache: C:\dev\workspace\mytest\target\mvn-eclipse-cache.properties [INFO] Not writing settings - defaults suffice [INFO] File C:\dev\workspace\mytest\.project already exists. Additional settings will be preserved, run mvn eclipse:clean if you want old settings to be removed. [INFO] Wrote Eclipse project for "mytest" to C:\dev\workspace\mytest. [INFO] [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESSFUL [INFO] ------------------------------------------------------------------------ [INFO] Total time: 18 seconds [INFO] Finished at: Thu Jan 31 13:57:55 PST 2008 [INFO] Final Memory: 3M/7M [INFO] ------------------------------------------------------------------------ Related Tutorials:
|