2

I come from Gradle world and I want to generate eclipse project for my build in Gradle I wrote

gradlew cleanEclipse eclise

but how to do that in Maven >3.0

I tried

mvn -npr eclipse:eclipse

but only eclipse .project files are generated. All dependency libraries are missing. So when I try to start i throught Eclipse

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/lang3/StringUtils
jopasserat
  • 5,721
  • 4
  • 31
  • 50
Xelian
  • 16,680
  • 25
  • 99
  • 152

2 Answers2

1

You don't need to generate Eclipse files (Eclipse does it for you).
Just import Maven project(s): File -> Import... -> Maven -> Existing Maven Projects

EDIT: If you don't have pom.xml in your Gradle project, then please generate one:

nerro
  • 111
  • 1
  • 4
  • But I have to install m2 plugin previously ? – Xelian Oct 29 '14 at 15:09
  • 1
    I don't want to.. The project is previously added by gradle and I want to migrate to maven.I want to rebuild it with Maven3 ,but when I do that libs disappeared. – Xelian Oct 29 '14 at 15:16
  • If you don't have pom.xml for you project. Generate first pom.xml (http://stackoverflow.com/a/17283856/4006992) and then import in Eclipse. – nerro Oct 29 '14 at 15:18
  • I created thepom.xml manually and for this pom I want maven to create me I eclipse poject? Is this possible? – Xelian Oct 29 '14 at 16:00
  • Sure. Have you tried to import your project in Eclipse? I recommend to use m2eclipse (m2 plugin) and not the mvn eclipse:eclipse, because plugin has better integration in IDE (nice pom editor etc.) – nerro Oct 29 '14 at 18:27
0

You should start by reading this: http://maven.apache.org/guides/getting-started/maven-in-five-minutes.html

Generating project in maven is very easy. In the terminal just type:

mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false

Only what you need to to is to change parameters to that what you require i.e. com.mycompany.app to package that you want to create.

damian_pol
  • 37
  • 1
  • 8
  • So think that I checkout sources from SVN and they do not have pom in it. I create POm manually and then I am wondering how to generate eclipse project. If I run your command will I receive this result? – Xelian Oct 29 '14 at 16:02
  • Have you try to check this: [generating Eclipse project files with Maven](http://stackoverflow.com/questions/3131285/generating-eclipse-project-files-with-maven) . Just change plugin version to which you have – damian_pol Oct 29 '14 at 16:12
  • YEs from there I saw mvn -npr eclipse:eclipse,but the jars are missing. And what if I want to build IteliJ Maven build? To install IDEA plugin for Maven, I don't want my build to be dependent to the IDE. I want command line to do all my building job – Xelian Oct 29 '14 at 20:22
  • if you want to download all the dependency jars assuming that you have add them as dependencies in your pom.xml you have to run one of them maven life cycle phases(mvn clean compile) should download the required defined dependencies. – redoc Jan 22 '15 at 09:28