how to convert maven web project into eclipse project

To convert a maven web project into eclipse importable format you need to use the maven eclipse plugin as below


mvn org.apache.maven.plugins:maven-eclipse-plugin:2.6:eclipse -DdownloadSources=true -DdownloadJavadocs=true

or


mvn eclipse:eclipse -Dwtpversion=2.0 clean install

above command will create your eclipse artifacts and also build your project.

in my pom.xml i configure eclipse plugin as below

	<build>
		<finalName>your-project-name-${version}</finalName>
		<plugins>
			<plugin>
				<artifactId>maven-compiler-plugin</artifactId>
				<!-- <version>2.3.1</version> -->
				<configuration>
					<source>1.6</source>
					<target>1.6</target>
				</configuration>
			</plugin>
			<plugin>
				<artifactId>maven-surefire-plugin</artifactId>
				<configuration>
					<skip>true</skip>	
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-eclipse-plugin</artifactId>
				<version>2.6</version>
				<configuration>
					<downloadSources>false</downloadSources>
					<downloadJavadocs>false</downloadJavadocs>
					<wtpversion>2.0</wtpversion>
					<sourceExcludes>
						<sourceExclude>**/.svn/**</sourceExclude>
					</sourceExcludes>
				</configuration>
			</plugin>
		</plugins>
	</build>

Skipping tests using maven surefire plugin is not recommended, but sometimes you might want to disable tests to build quickly.

Advertisements

, ,

  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: