wiki:MavenWithEclipse
Last modified 7 years ago Last modified on 12/06/11 18:08:08

Building dcache via maven in Eclipse

At this time there exist two plugins for Eclipse to work with maven projects:

  • m2e
  • IAM

since the provided functionality of m2e is greater, we will only cover that one.

To import dcache into Eclipse do the follwing:

  • Get a clean checkout of dcache.
  • Start Ecliplse
  • Choose "Import" from the file menu and pick Maven->Import existing maven project
  • on the then shown dialog simply click on "Finish"

You should now see all modules in the Project Explorer. It will take a while for the projects to refresh and build. When this is finished most of the projects are failing. This is due to a wrongly automatically set Java VM version and Code compliance levels. To fix it do the following:

  • Open the project settings
  • Go to Java Build Paths
  • Remove JVM 5 and add JVM 6 or 7 as library
  • Go to Compiler
  • Set Compiler compliance to (1.6 or 1.7)
  • Set Generated .class files compatibility to 1.5
  • Set Source compatibility to 1.5

after that, all projects but dcache-core should build fine. dcache-core depends on two classes that are generated from state machine definitions. To generate those files do:

  • Execute "ant dcache"
  • Open the project settings of dcache-core
  • Go to Java Build Path->Source
  • Add folder "dcache-core/target/generated-sources/smc/smc"
  • Set Output folder of this source folder to "dcache-core/target/classes"

Now all projects should build fine.

Troubleshooting

  • After building mvn install target, maven generates some files in .m2/repository/org/dcache/ that (might) interfere with eclipse build. To resolve this, delete the directory .m2/repository/org/dcache/.
  • OutOfResources? Error while building. This error apparently occurs because the default Maven PermSize? is too small. To resolve this, do export MAVEN_OPTS="-Xmx384m -XX:PermSize=256m" and build again. A good place to set this is the file ~/.mavenrc
  • Missing artifact errors. Some projects in Eclipse don't build because of unresolved dependencies. This may happen because old projects have been split into new projects. Repeat the Import step and add new projects. Don't forget to set the JVM settings as before.

Attachments

  • make-m2e-project.sh (732 bytes) - added by karsten 7 years ago. Script to create patch (EclipseFiles?) from files generated by Eclipse (.project, .classpath, .settings/*). It should be executed after all steps on this page have been executed.
  • EclipseFiles (72.9 KB) - added by karsten 7 years ago. For the lazy: You can also apply this patch to your dcache directory to have all files generated. Make sure Eclipse is not running!
  • GeneratedSMCFiles (87.4 KB) - added by karsten 7 years ago. Patch 2 of the shortcut: Adds the path information for the SMC files to dcache-core settings files.