2

I have integrated m2e plugin.When i change the java file .It invokes building workspace. Is this is eclipse build or maven build.

And what exactly the difference between Eclipse clean and mvn clean ?

Aaron Digulla
  • 321,842
  • 108
  • 597
  • 820
uhs
  • 838
  • 1
  • 7
  • 21

2 Answers2

1

The m2e plugin injects the Maven classpath into the Eclipse project plus it disables the default Eclipse resource copying so Maven can do it's magic (the Maven resource copy step can filter/transform resources).

The actual build for Java files uses the Eclipse compiler with the classpath supplied from m2e.

Clean: Unless you have configured something special, Eclipse clean will delete target/classes and target/test-classes while mvn clean will delete the whole target/ folder.

Also, Eclipse will build the project again right after clean. For Maven, you need to issue another command (mvn compile or mvn install).

Aaron Digulla
  • 321,842
  • 108
  • 597
  • 820
  • Suppose if a java file is changed .Is it mandatory to do mvn clean ,so that it would be reflected or eclipse clean is enough.? – uhs Nov 26 '14 at 14:36
  • If you have "Build automatically" enabled, you just need to save the Java file in Eclipse to compile it. No "clean" is necessary. – Aaron Digulla Nov 26 '14 at 14:39
  • Can eclipse build generate WAR file like mvn build ?I am not sure about these things. When i click on server add new resources to deploy in server.Is that mandatory that it should be a war file ? – uhs Nov 26 '14 at 14:43
  • Eclipse doesn't build a WAR. Instead the various plugins know how to deploy the files directly for a certain kind of server. If you want a WAR, read the documentation for the Maven WAR plugin. – Aaron Digulla Nov 26 '14 at 14:54
1

Check your .project file.

Do you have something like org.eclipse.m2e.core.maven2Builder there? Then it's Maven build executed by Eclipse via m2e.

The exact difference between "Eclipse clean" and mvn clean...

mvn clean executes Maven clean phase, as it is configured (or inherited) in the pom.xml.

For Eclipse clean, see this question:

Function of Project > Clean in Eclipse

Community
  • 1
  • 1
lexicore
  • 42,748
  • 17
  • 132
  • 221
  • Thanks lexicore. Does eclipse build generate war file.If no how we are able to deploy project and publish ? – uhs Nov 26 '14 at 14:45