On 19/02/2008, Nikolay Karasev <[EMAIL PROTECTED]> wrote: > > > I had to add manually a couple of jar files from ~/.m2 that were not > > > added by this command. Also as far as this commend simply expands the > > > entire repository to individual files - I'd say it is only half way > > > helpful. It seems that eclipse team might want to have some sort of > > > auto-expand feature. > > > > > > Not entirely sure what you mean by "expands entire repository to > individual > > files" but I have used mvn eclipse:eclipse for a while now on both > modular > > and basic projects and have never had to manually add any dependencies. > > Could you describe the process you followed? > > First of all I must say that I am using Fedora 8 (so that's Linux, not > Windows and not Leopard). > > I did exact steps from AppFuse eclipse installation page (except that > there is no eclipse 3.2 anymore, I had to use the latest 3.3.1.1) > -install eclipse > -set home vars > -install new appfuse modular ( with Spring) > -run command mvn install eclipse:eclipse > -opened eclipse and imported projects from appfuse installation root - > this created two projects: core and webapp
This looks correct although you seem to be missing the step where you set up the M2_REPO path variable inside Eclipse: mvn -Declipse.workspace=<path_to_repo> eclipse:add-maven-repo I have found in the past this needs to be run with Eclipse shut down and must be run before running mvn eclipse:eclipse on your project. > Upon the import of projects both projects immediately gave way: they > were with some unresolved path errors. Also one of the xml files > (src/test/resources/login.xml) is an invalid xml file (does not have > root element) and eclipse complains. > > Then I went to project->properties->Libraries and that window has > shown me that there are about 3 dozens of imports, each import is a > separate JAR file from maven repository, each import starts with the > var name M2_REPO and then following the rest of path to individual JAR > file. So that maven repository was resolved and expanded automatically > in this case. I cannot tell if all of the JARs were imported using > this fresh new installation since I have not done any custom code on > that installation. However it proved once again that eclipse does not > like maven repository defined as single path - it expands all of it. This is normal as the repository contains jar files - these need to be added to the path one at a time. > Besides using steps exactly as defined in AppFuse installation for > eclipse I did this: > > I had previous eclipse installation. I installed AppFuse modular to > new directory and I created project in eclipse setting the root to be > the same as the root for appfuse. After that I had to manually specify > which directories I want to use as source directories and I had to > remove some others that eclipse did automatically. So after those > adjustments I had only two directories defined as source for eclipse: > core/src/main/java and core/src/test/java. > Then I started adding new java files as described in Appfuse tutorials > and immediately found out that non of the maven repository JARs is > available for eclipse. This is expected since at this time I did not > run mvn eclipse:eclipse yet. > So I quit eclipse and run mvn eclipse:eclipse. After running eclipse > again I found out that the couple of JAR files were not added to the > path and the rest of jars from maven repo were added one by one. This > is where I had to manually add few jar files to the classpath. As long as you run mvn eclipse:eclipse from the root directory only, all should work as expected. Any file you have specified as a dependency in your project pom.xml files will be added to the relevant classpath. It does not add all jar files in your repository automatically. > I then did it differently: installed new eclipse, installed new > appfuse modular, run mvn install eclipse:eclipse and found out that > the appfuse root did not have .project and .classpath files for > eclipse, but they were created in core and webapp. This is expected. I > copied file .classpath from core directory to root and created eclipse > project pointing to root. Same result: when I added custom code I had > to manually add few JAR files to path since not all were imported by > maven command. If you want to add jar files to your project path that are not listed as dependencies by AppFuse, you simply need to add a new dependency to the pom.xml file, run mvn eclipse:eclipse from the root again and refresh the project in Eclipse. Mike > All in all after spending a couple of days (not entire days but a few > hours of each :( I managed to get modular project with Spring (using > root, not core or webapp as eclipse project directory) with all paths > resolved so the eclipse does not complain anymore and its code > auto-complete feature works fine (all JARs are visible and linked). I > did add custom classes (per appfuse tutorial). Maven always worked > fine. The issues were only on the eclipse side. > > So as it stays now: eclipse is using every single JAR file separately, > however linked through M2_REPO path variable. It was a long time to > get to this point from start. > > I understand that this is eclipse and/or maven issues and AppFuse > project itself has nothing to do with it (in other words - there is > nothing to fix in AppFuse to make things work for eclipse easier than > I did). > > Hope this gives some insights. > > Nikolay > > > > > > > > There was another strange thing with this command on modular appfuse: > > > it did not create .project and .classpath file in the root, only in > > > the core and webapp directories. I had to resort to using basic > > > appfuse instead of modular for the whole thing to finally pass through > > > the first JUnit test and have eclipse not complaining about > > > dependencies. I wonder if somebody with modular appfuse has actually > > > done this to eclipse. > > > > > > This is an unfortunate feature of the maven eclipse plugin - it does not > > include the root of multi-module projects as an eclipse project. This > should > > not stop your tests working though - have you followed the instructions > here > > http://www.appfuse.org/display/APF/Eclipse to get your project up and > > running? The worst effect this should have is that if you need to edit > the > > root pom.xml you need to do it outside eclipse. > > > > Since I had managed to use single eclipse project from appfuse root - > I can edit root pom.xml directly from eclipse. > All maven commands (goals should you say) have always run with no > problems and project is working in its entirety. > > I expect that I will be able to use maven plugin for eclipse to run > all maven commands from eclipse, but this is not really the point of > desire :-0 > > Thanks, > Nikolay > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >
