I see point for having web as project. But having xml files not being well formed, I believe, is a mistake in the first place. Shouldn't AppFuse do something about it? Like may be have not login.xml but login.xml.template or something like that?
I agree that eclipse could be fussy, but since this is platform of choice and since it actually is trying to do a good job checking all your code including xml - I think I'd rather stick with eclipse and fix what is broken (in this case appfuse appears to be broken) Regards, Nikolay On Feb 19, 2008 10:02 AM, Michael Horwitz <[EMAIL PROTECTED]> wrote: > > > > On 19/02/2008, Nikolay Karasev <[EMAIL PROTECTED]> wrote: > > Ok, I installed all fresh again this time using mvn > > -Declipse.workspace=<path_to_repo> eclipse:add-maven-repo and it looks > > like all the required JAR files were added to the .classpath > > So maybe the very reason for all this weirdness that I experienced was > > due to slight mis-following of the recommended steps?... > > > > Now I have a question: does it make any sense to use root of modular > > appfuse as project directory for eclipse? Maybe I shouldn't bother > > trying to do so since all java sources are in the core only. Like you > > pointed right - modifying pom.xml would be outside of eclipse but this > > is the least worry since pom shouldn't be modified often if at all. > > Why do we even need webapp as eclipse project since there is nothing > > to compile? Also eclipse complains about a few things (login.xml is > > malformed) > > > The web module contains all the web related code and resources. For the > Spring archetypes the web module would contain all .jsp pages and the > controller source code. > > Eclipse can be a bit fussy about some of the xml files. There is more than > likely a way to turn this checking off. > > Mike. > > > > > Thanks, > > Nikolay > > > > On Feb 19, 2008 9:08 AM, Michael Horwitz <[EMAIL PROTECTED]> wrote: > > > > > > > > > > > > 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] > > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
