简体   繁体   中英

How do I set up a new Java project with Eclipse, Maven, Grails and git?

I'm new to Grails development and would like to set up a new project, so I can use Eclipse as IDE and build it on my CI (Jenkins) with Maven. This is my environment:

  • Java 1.6.0
  • Grails 2.1.0
  • Maven 2.2.1
  • Eclipse Juno with the m2e and egit plugins

I used the following commands from http://grails.org/doc/latest/guide/commandLine.html#antAndMaven :

mvn archetype:generate -DarchetypeGroupId=org.grails \
-DarchetypeArtifactId=grails-maven-archetype -DarchetypeVersion=2.1.0 \
-DgroupId=com.company.dep -DartifactId=project
mvn initialize

But after importing it as a maven project in Eclipse, there were erros about slf4j and com.sun.tools not found and lifecycle phases not mapped.

What steps are necessary to get this running in Eclipse?

Plugins, Plugins, Plugins... you can add the maven plugin / Grails plugin for eclipse and just build a new project.

Select the option to create a maven project (it will auto generate the pom files for you) then you can add Grails to it...

Similarly you can start a new grails project and then add maven to it. It will download all the dependencies automatically.

Most plugins are free to download from : http://marketplace.eclipse.org

当Eclipse使用JRE而不是JDK时,通常会导致com.sun.tools错误。

Grails has its own mechanism for creating projects, use it. Since Grails 2.1 you can generate the maven stuff afterwards.

You can follow this proces:

  1. Get STS - Springsrouce Tool Suite (actual 3.0), based on Eclipse
  2. Install the Grails plugin into STS.
  3. Get the Grails FW, unpack it and configure the path to it in STS.
  4. Create new project via Grails command: grails create-app
  5. Import it into Git.

About maven integration, there is a good article:

http://www.znetdevelopment.com/blogs/2012/07/11/grails-2-1-and-maven-integration-simple-project/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM