Here's a quick list on things you need to do:
- download and install a recent eclipse
- in eclipse, go to Window/Preferences/Java/Build Path/Classpath variables, and add M2_REPO, have it point to your local maven repository (usually $HOME/.m2/repository/). You can do a mvn -Declipse.workspace=/home/user/workspace eclipse:configure-workspace instead of configuring it manually if you want.
- check out deegree trunk from https://svn.wald.intevation.org/svn/deegree/deegree3/trunk/. You can check it out into your eclipse workspace, we can import the projects properly later on.
- run the maven eclipse plugin plus deegree maven plugin in the trunk folder using mvn -Declipse.workspace=/home/user/workspace -DdownloadSources=true -DdownloadJavadocs=true -Dwtpversion=2.0 eclipse:clean eclipse:eclipse deegree:create-links -Declipse.formatter=deegree (all in one line please)
- use File -> Import -> General -> Existing Projects into Workspace in eclipse to import all projects at once. Choose the directory with your deegree checkout as a starting point to scan for projects.
I like it when things just work, but in case they don't I usually want to know what exactly happens on my computer. So let me explain what happens when you run the maven plugins.
The Maven Eclipse plugin generates the .project, .settings and .classpath files/folders for you. It adds the correct source/resource folders in eclipse, output folder, project/library dependencies and even generated source folders (such as the ones generated by the jaxb plugin).
That's already neat. But we currently have 86 maven projects in a hierarchical project tree, and eclipse wants to have the projects flat in its workspace. That's where the deegree maven plugin can help. On Linux it automatically symlinks the projects to the eclipse workspace folder, although this is not strictly necessary any more (eclipse projects need not be directly in the workspace).
Now getting back to management telling you how to format your code. It's not an option to manually set the formatter for 86 projects. Other projects may require a different formatter, so just setting the default is also not an option. Version 1.4 of the deegree maven plugin let's you specify a formatter using -Declipse.formatter=xxx (as shown above). Currently deegree and eclipse120 are supported, with deegree being our custom code style and eclipse120 being the standard eclipse formatter modified to allow 120 characters per line (instead of the default 80).
So that's it. Please tell if something does not work out as expected.
By the way, the deegree maven plugin can do more stuff. It has some helpers for web service integration testing, deegree workspace management and other utilities. There is a wiki page describing some of it, but it's currently outdated, only some of the functionality is documented.
Edit: Added a few missing steps to get everything to compile properly (Lombok and M2_REPO). Thanks Martin!
Edit: Updated the post with a couple of new things we learned. Also Lombok is not needed any more.
Have been struggling with this all morning. Lots of stuff breaking -- its maven, its magic, where to start? I'm using the eclipse indigo. I checked out the deegree-core (figured I'd start small). Ran mvn from the command line per your instructions. Managed to import the maven projects -- sort of. Fails to complete -- some j2ee jar complains about failure to validate. Also, something wants to update the eclipse m2e plugin, but too fails in mid stride. Suggestions?
ReplyDeleteWhat maven version are you using? I'd recommend maven 3. Can you provide some details/error messages?
Deletehere's the maven version info. I'll send the errors when i get a chance. Thanks. BTW: Is there some simple way for us to email? I'm at (jonb at jmbaai dot com)
DeleteApache Maven 3.0.4 (r1232337; 2012-01-17 00:44:56-0800)
Maven home: C:\Software\apache-maven-3.0.4\bin\..
Java version: 1.7.0_02, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.7.0_02\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "x86", family: "windows"
the maven version looks fine. You can discuss build issues on our mailing lists:
Deletehttp://www.deegree.org/Community
I started from scratch....
Delete1) Checked out core, services, and tools from SVN into an eclipse ws.
2) Ran mvn with your args from the deegree-core project dir in my eclipse ws, with the ws arg set to my ws dir (i.e. parent of the deegree-core dir).
3) In eclipse, right-click on core project and select import existing maven projects.
4) generate-buildinfo and generate-jaxb-catalog were marked by the system to be resolved later
5) The system tried to install m2e, which produced several errors......
An internal error occurred during: "Validating deegree-core-annotations".
org.eclipse.jst.j2ee.project.facet.IJ2EEFacetConstants
Errors occurred during the build.
Errors running builder 'Faceted Project Validation Builder' on project 'deegree-core-base'.
Could not initialize class org.eclipse.jst.j2ee.project.facet.IJ2EEFacetConstants
Errors running builder 'Validation' on project 'deegree-core-base'.
......etc, for many deegree-core sub-projects.
6) When install completed, restarted eclipse.
7) Upon restart, the workspace autobuild threw an error......
An internal error occurred during: "Validating deegree-core-annotations".
org.eclipse.jst.j2ee.project.facet.IJ2EEFacetConstants
............etc, similar (same?) as before.
8) None of the java compiled -- all have errors because eclipse project deps are not set up.
9) Tried to re-import existing maven projects but all projects are marked as already being imported.
Suggestions?
Oops! My mistake. The 135 errors are NOT all due to compile errors. This time there is a group of them of the form.....
DeleteDescription Resource Path Location Type
Plugin execution not covered by lifecycle configuration: org.deegree:deegree-maven-plugin:1.12:generate-buildinfo (execution: buildinfo, phase: generate-resources) pom.xml /deegree-core-3d line 12 Maven Project Build Lifecycle Mapping Problem
......and it looks like a good bit of the code did compile.
In any case, almost every project is flagged with an error of some sort.
Maybe you should try to use the approach outlined in this article, NOT using m2eclipse, but using mvn on the command line...
DeleteI did use mvn on the command line -- step 2) above.
DeleteMaybe you're using the wrong import button then? With this approach, you don't need m2eclipse at all, it will probably just break things (many plugins seem not to be supported by m2eclipse).
DeleteAs I described above, the choice to install the plugin was not mine -- eclipse decided to do it.
DeleteAs described above in 3), I used "import existing maven projects." Which import should I be using?
In 4), what about the "to be resolved later". Perhaps that is what compelled eclipse to try and install the m2e plugin.
I believe the import option is 'Existing projects into workspace'. I'll clarify what option to use in the post.
DeleteI started from scratch again, and then tried importing "Existing projects into workspace". I tried this from the ws dir -- eclipse found no projects. I did this from the deegree-cor dir -- eclipse found no projects. I did this from the deegree-core/deegree-core-3d dir (eclipse does not allow multi-select here) -- eclipse ran, the 3d project showed up in the ws dir, but eclipse threw an in initializer exception and marked the project with "!".
DeleteSuggestions?
For grins I decided to import each project under deegree-core -- one by one. Each time eclipse did an import, it tried to rebuild the ws, and each time it reported an error of the form.....
DeleteErrors occurred during the build.
Errors running builder 'Faceted Project Validation Builder' on project 'deegree-core-theme'.
Could not initialize class org.eclipse.jst.j2ee.project.facet.IJ2EEFacetConstants
.......this is the same error I was getting earlier (step 7).
At the end I tried doing a clean. Each imported project threw an error as described above, and 371 errors total were indicated.
Looking in the ws dir with a browser I see a bunch of files with no file extension with names resembling the nested project files. Could it be that these are supposed be some sort of eclipse project link? If so, they aren't being seen by my eclipse.
That's strange. I can select any directory, and eclipse will list all subprojects that are not pom projects (all jar and war projects).
DeleteDo you have the J2EE version or the standard version of eclipse? If you have the standard version, try installing the WTP plugin (Web Tools Platform).
If you have no more build path errors, what other errors do you get? Some XML files validation errors are unresolvable (some example setups cannot be validated due to schema problems).
WTP seems to be included with the standard Indigo release (or I installed it somewhere along the way). I do not have J2EE. I tried installing it and some other web project stuff (e.g. faceted projects) but after the install crawled along for half an hour it threw an error.
DeleteIn any case, what are the magic files created by maven in the root ws supposed to be? Are they in some format that eclipse recognizes? Should the files have an extension?
BTW: Is there any alternative to maven for doing an install?
The files created are the .project and .classpath files in the module folder, what or if anything is created in the workspace I do not know.
DeleteOf course you can set up a module manually, but then you'd have to add all dependencies by hand. You can get a list of the actual dependencies of a module by running mvn dependency:tree.
Looks like other folks have come across this.....
Deletehttp://warpedjavaguy.wordpress.com/2011/08/08/how-i-defeated-the-maven-release-plugin-in-a-flat-structured-multi-module-project/
.....Why it works for you is a mystery. Seems that I have to manually import each project from within the hierarchy into the top level of my ws (the first time I did it I overlooked importing the deeper level projects) -- eclipse is not auto-discovering them, nor is it seeing the symlinks in the ws (except as mere resource files, which is useless for project import). All of this seems like core eclipse stuff, not eclipse web stuff.
I'm not wisen in the ways of maven. Perhaps the above link will allow you to come up with a more reliable way to install deegree in eclipse (until eclipse can get their maven mess straightened out).
Thanks for your help.
I poked around a bit more......
Deletehttp://stackoverflow.com/questions/2609938/what-happened-to-the-enable-nested-modules-option-in-m2-eclipse
....After making this change I ran mvn and then did a *maven* import into eclipse (as I had done originally). This time it got ALL the projects. Still need to build/import tools and services to see if everything comes together properly. But, so far so good.
Good to hear. Still, we're several developers here who use this approach, and none of us is having such problems. So I think why it does not work for you is the mystery ;-)
DeleteThe nested structure should be broken down by eclipse into the flat structure automatically.
Although I now have all the sub projects flattened in the ws, they are marked as maven projects and all have maven (and other) errors.
DeleteIn desperation I started from absolute scratch: Brand new "J2EE" version of eclipse, a brand new ws, checked out the entire trunk (per your directions), ran mvn, see the symlinks in the ws.
Eclipse still cannot see the symlinks as projects (why should it -- my experience is that symlinks are used for resources). What version/flavor of eclipse are you guys using? Have you tried to follow your instructions with a new eclipse and ws (as I did)? If not, I strongly recommend you try and then update your instructions accordingly.
I use the J2EE Indigo release of eclipse, but 3.5 or 3.6 should work just as well. And yes, I follow these instructions to the letter all the time (just recently I've set up 2 new computers).
DeleteOf course eclipse does not see the symlinks immediately as projects, that's why you need to import them into the workspace. As written above, choose the root checkout folder, and eclipse will find all jar/war subprojects of that folder.
But I don't have the m2eclipse plugin installed, I'm still pretty sure that it causes major problems. When we evaluated how to make sure both maven and eclipse building are easy, we pretty quickly dismissed the m2eclipse plugin and moved to eclipse:eclipse.
If your projects show maven errors in eclipse, you did something different, or something besides following the instructions.
The maven errors were from an earlier attempt.
DeleteThis is a clean eclipse j2ee. The only thing installed is Subclipse for SVN. The only setting I made was the M2_REPO. I am on Windows 7...
1) Via eclipse, I checked out trunk into my ws as a project via SVN. I see the checked out "trunk" project.
2) Via command I cd to ws/trunk, and run mvn, with "-Declipse.workspace=" set to my ws.
3) Via explorer I see the generated links in ws.
4) Via eclipse, I still only see the "trunk" roject. I select Import->General->Import existing projects.
5) The Import dialog opens. I browse to the ws dir as the root directory.
6) The dialog shows the "trunk" project grayed out, with the warning message in the title bar "Some projects cannot be imported because they already exist in the workspace"
This is pretty straightforward, and it doesn't work. Have I made an error? Are you using Windows? At what stage of the process to you see/do something different?
Aha, now we're getting somewhere. Try deleting the 'trunk' project from eclipse (of course not deleting from disk, only from eclipse), then do the import procedure. Looks like eclipse recognizes the folder if you check it out from within eclipse.
DeleteI usually check out from svn using the command line. If it works, that way, please tell so I can update the description.
By the way, I think the symlinks are not strictly necessary, at least 3.7 seems to be able to import projects from another folder anyway. Some people find the flattened directory/symlink structure useful anyway, that's why they are still created.
That did not work. When I tried to do the import eclipse found "trunk", and only trunk. And, this time, it was not grayed out. So, there is definitely some piece of this that we are both missing.
Delete(Reposting -- original never went through....)
ReplyDeleteBingo!
I did as you suggested but eclipse simply found the "trunk" project, and this time it was not grayed out.
Seems that eclipse will NOT search beyond the top-level directory if it finds a ".project" file there (which will be left in a project even if that project is "deleted" from eclipse).
On a hunch I deleted the .project file in "trunk" and eclipse then did a deep dive into it and found all the nested projects.
BTW: I poked around all the "example" projects looking for something to execute to confirm that everything was installed properly, but nothing there was nothing obvious. Is there some quickie test?
Thanks again for your help with this.
Good to hear! For starters, you should be able to run the deegree-webservices module with 'Run on server'. Done that, you can point your browser to http://localhost:8080/deegree-webservices/ to access the web service console (password is deegree).
DeleteIt works!
DeleteBTW: I've worked with Google Earth and WorldWind. I was considering using Deegree as a platform for a project I'm working with. Has someone done a comparison of features or provided demo apps to do interactive 3D perspective presentations?
Also, I checked out the deegree forum, and it doesn't seem very active. Where is the best place to go to discuss such matters?
The deegree users and developer mailing lists are still the best place for a discussion. I'm not sure about the state of the 3D stuff in deegree, they're not actively maintained at the moment.
Delete