9 Replies Latest reply on Apr 6, 2010 2:26 PM by Max Rydahl Andersen

    build path not set correctly after importing from svn for mavenized Seam project

    Arbi Sookazian Master

      http://maven.apache.org/guides/mini/guide-ide-eclipse.html

       

      I have noticed that with my multi-module Mavenized Seam 2.1 project, I must always run 'mvn eclipse:eclipse' after I have imported the project from SVN repo, otherwise the build path is not correct and I see a lot of bad reference errors from compiler in Eclipse.

       

      I am using m2eclipse 0.9.8 and JBT 3.1.0-M4 with Eclipse 3.5.1.SR1 (Galileo).

       

      Is there a way to get around this (i.e. have the build path set correctly after importing the project from svn)?  thx.

        • 1. Re: build path not set correctly after importing from svn for mavenized Seam project
          Max Rydahl Andersen Master

          Do *not* use mvn eclipse:eclipse - ever.

           

          Use m2eclipse and the wtp integration.

           

          And upgrade to something more recent than old milestone builds

          • 2. Re: build path not set correctly after importing from svn for mavenized Seam project
            Arbi Sookazian Master

            Well, I just created a new branch off the svn trunk and created a new Eclipse/JBT workspace.  I imported the project as a Maven project (via the m2e plugin?)  I had to run the 'mvn eclipse:eclipse' again to fix the build path.  here are the before and after pics.

             

            build-path-before.GIF

             

            after:

             

            build-path-after.GIF

            Please explain how I can get the libraries to show properly like the after pic above using m2e or the Maven new project import process.  If you say don't use 'mvn eclipse:eclipse', ok fine, so why is my build path (libraries) messed up every time I import my project into a new workspace and how can I fix it using JBT/m2e???

            • 3. Re: build path not set correctly after importing from svn for mavenized Seam project
              Denis Golovin Master

              What do you have in "Maven Dependencies" classpath container? All libraries should be there.

              1 of 1 people found this helpful
              • 4. Re: build path not set correctly after importing from svn for mavenized Seam project
                Arbi Sookazian Master

                Here it is for a different module in the workspace:

                 

                maven-dependencies.GIF

                Is this info derived from a pom.xml?

                • 5. Re: build path not set correctly after importing from svn for mavenized Seam project
                  Denis Golovin Master

                  I'm not actually Mavenized enough yet IMO it is derived form pom.xml, but I can't declare what exactly it should contain: only direct dependencies  declared in pom.xml or derived as well. It might be a good idea also to ask question or report issue to m2eclipse plug-in about your particular problem, please look for additional information here.

                  • 6. Re: build path not set correctly after importing from svn for mavenized Seam project
                    Arbi Sookazian Master

                    https://issues.sonatype.org/browse/MNGECLIPSE-2183

                     

                    I did not know that m2e plugin was so new (0.9.8 was released in 05/09).  I was under the impression that it had been out for some years now...

                    • 7. Re: build path not set correctly after importing from svn for mavenized Seam project
                      Max Rydahl Andersen Master

                      As I wrote: "Use m2eclipse and the wtp integration" and upgrade.

                       

                      And yes, that Maven Depedendencies is derived from your pom.xml.

                      • 8. Re: build path not set correctly after importing from svn for mavenized Seam project
                        Arbi Sookazian Master

                        I upgraded to 3.1.0.GA JBT.

                         

                        So I think I nailed down the root cause of why m2e can't accommodate my projects in terms of proper classpath/build path.  Ultimately it comes down to the Maven Dependencies list being incomplete/wrong I guess but not sure how to fix this as my Seam application consists of two higher-level pom.xml (i.e.this is multi-module scenario consisting of two project with multi-modules and one depends on the other for services, API calls, etc.)  Thus, I typically run 'mvn clean install' on two pom's, first model, then GUI.

                         

                        I have two parent pom.xml files.  One is dependent on the other (the model pom has the DAO, domain/entity classes, etc).  These are apparently two independent projects when I do a svn checkout as Maven project.

                         

                        So the following .classpath file for one of the mvn modules in the non-model project (it's called GUI which depends on Model packages/classes, etc.) does not have references to the model modules/projects so these packages and classes are unrecognizable by the compiler:

                         

                        <?xml version="1.0" encoding="UTF-8"?>
                        <classpath>
                            <classpathentry kind="src" output="target/classes" path="src/main/java"/>
                            <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
                            <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
                            <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
                            <classpathentry kind="output" path="target/classes"/>
                        </classpath>

                         

                        When I run 'mvn eclipse:eclipse', the .classpath contents for this module/project change to the following which "fixes" the compiler resolution errors b/c of the classpathentry entries below for the cis.crud.dao, cis.crud.domain, etc which are apparently missing when m2e creates the .classpath file:

                         

                        <classpath>
                          <classpathentry kind="src" path="src/main/java" including="**/*.java"/>
                          <classpathentry kind="src" path="src/main/resources" excluding="**/*.java"/>
                          <classpathentry kind="output" path="target/classes"/>
                          <classpathentry kind="var" path="M2_REPO/javax/el/el-api/1.2/el-api-1.2.jar"/>
                          <classpathentry kind="var" path="M2_REPO/javax/javaee/javaee/5.0/javaee-5.0.jar" sourcepath="M2_REPO/javax/javaee/javaee/5.0/javaee-5.0-sources.jar">
                            <attributes>
                              <attribute value="jar:file:/C:/Documents%20and%20Settings/asookazian/.m2/repository/javax/javaee/javaee/5.0/javaee-5.0-javadoc.jar!/" name="javadoc_location"/>
                            </attributes>
                          </classpathentry>
                          <classpathentry kind="var" path="M2_REPO/com/echo/cis/model/com.echo.cis.crud.dao/1.5.1-SNAPSHOT/com.echo.cis.crud.dao-1.5.1-SNAPSHOT.jar" sourcepath="M2_REPO/com/echo/cis/model/com.echo.cis.crud.dao/1.5.1-SNAPSHOT/com.echo.cis.crud.dao-1.5.1-SNAPSHOT-sources.jar"/>
                          <classpathentry kind="var" path="M2_REPO/com/echo/cis/model/com.echo.cis.crud.domain/1.5.1-SNAPSHOT/com.echo.cis.crud.domain-1.5.1-SNAPSHOT.jar" sourcepath="M2_REPO/com/echo/cis/model/com.echo.cis.crud.domain/1.5.1-SNAPSHOT/com.echo.cis.crud.domain-1.5.1-SNAPSHOT-sources.jar"/>
                          <classpathentry kind="var" path="M2_REPO/com/echo/cis/model/com.echo.cis.domain/1.5.1-SNAPSHOT/com.echo.cis.domain-1.5.1-SNAPSHOT.jar" sourcepath="M2_REPO/com/echo/cis/model/com.echo.cis.domain/1.5.1-SNAPSHOT/com.echo.cis.domain-1.5.1-SNAPSHOT-sources.jar"/>
                          <classpathentry kind="var" path="M2_REPO/com/echo/cis/model/com.echo.cis.ejb.dao/1.5.1-SNAPSHOT/com.echo.cis.ejb.dao-1.5.1-SNAPSHOT.jar" sourcepath="M2_REPO/com/echo/cis/model/com.echo.cis.ejb.dao/1.5.1-SNAPSHOT/com.echo.cis.ejb.dao-1.5.1-SNAPSHOT-sources.jar"/>
                          <classpathentry kind="var" path="M2_REPO/commons-lang/commons-lang/2.2/commons-lang-2.2.jar" sourcepath="M2_REPO/commons-lang/commons-lang/2.2/commons-lang-2.2-sources.jar">
                            <attributes>
                              <attribute value="jar:file:/C:/Documents%20and%20Settings/asookazian/.m2/repository/commons-lang/commons-lang/2.2/commons-lang-2.2-javadoc.jar!/" name="javadoc_location"/>
                            </attributes>
                          </classpathentry>
                          <classpathentry kind="var" path="M2_REPO/org/jboss/embedded/hibernate-all/beta3/hibernate-all-beta3.jar"/>
                          <classpathentry kind="var" path="M2_REPO/org/hibernate/hibernate-validator/3.0.0.ga/hibernate-validator-3.0.0.ga.jar"/>
                          <classpathentry kind="var" path="M2_REPO/org/jboss/microcontainer/jboss-deployers-client-spi/2.0.0.Beta6/jboss-deployers-client-spi-2.0.0.Beta6.jar" sourcepath="M2_REPO/org/jboss/microcontainer/jboss-deployers-client-spi/2.0.0.Beta6/jboss-deployers-client-spi-2.0.0.Beta6-sources.jar"/>
                          <classpathentry kind="var" path="M2_REPO/org/jboss/microcontainer/jboss-deployers-core-spi/2.0.0.Beta6/jboss-deployers-core-spi-2.0.0.Beta6.jar" sourcepath="M2_REPO/org/jboss/microcontainer/jboss-deployers-core-spi/2.0.0.Beta6/jboss-deployers-core-spi-2.0.0.Beta6-sources.jar"/>
                          <classpathentry kind="var" path="M2_REPO/org/jboss/el/jboss-el/2.0.2.CR1/jboss-el-2.0.2.CR1.jar" sourcepath="M2_REPO/org/jboss/el/jboss-el/2.0.2.CR1/jboss-el-2.0.2.CR1-sources.jar"/>
                          <classpathentry kind="var" path="M2_REPO/org/jboss/embedded/jboss-embedded/beta3/jboss-embedded-beta3.jar"/>
                          <classpathentry kind="var" path="M2_REPO/org/jboss/embedded/jboss-embedded-all/beta3/jboss-embedded-all-beta3.jar"/>
                          <classpathentry kind="var" path="M2_REPO/org/jboss/seam/jboss-seam/2.1.1.GA/jboss-seam-2.1.1.GA.jar" sourcepath="M2_REPO/org/jboss/seam/jboss-seam/2.1.1.GA/jboss-seam-2.1.1.GA-sources.jar"/>
                          <classpathentry kind="var" path="M2_REPO/org/jibx/jibx-bind/1.1.5/jibx-bind-1.1.5.jar"/>
                          <classpathentry kind="var" path="M2_REPO/org/jibx/jibx-extras/1.1.5/jibx-extras-1.1.5.jar"/>
                          <classpathentry kind="var" path="M2_REPO/org/jibx/jibx-run/1.1.5/jibx-run-1.1.5.jar"/>
                          <classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar" sourcepath="M2_REPO/junit/junit/3.8.1/junit-3.8.1-sources.jar"/>
                          <classpathentry kind="var" path="M2_REPO/log4j/log4j/1.2.13/log4j-1.2.13.jar" sourcepath="M2_REPO/log4j/log4j/1.2.13/log4j-1.2.13-sources.jar"/>
                          <classpathentry kind="var" path="M2_REPO/net/sf/opencsv/opencsv/1.8/opencsv-1.8.jar" sourcepath="M2_REPO/net/sf/opencsv/opencsv/1.8/opencsv-1.8-sources.jar">
                            <attributes>
                              <attribute value="jar:file:/C:/Documents%20and%20Settings/asookazian/.m2/repository/net/sf/opencsv/opencsv/1.8/opencsv-1.8-javadoc.jar!/" name="javadoc_location"/>
                            </attributes>
                          </classpathentry>
                          <classpathentry kind="var" path="M2_REPO/stax/stax-api/1.0.1/stax-api-1.0.1.jar"/>
                          <classpathentry kind="var" path="M2_REPO/org/testng/testng/5.7/testng-5.7-jdk15.jar"/>
                          <classpathentry kind="var" path="M2_REPO/org/jboss/embedded/thirdparty-all/beta3/thirdparty-all-beta3.jar"/>
                          <classpathentry kind="var" path="M2_REPO/org/codehaus/woodstox/wstx-asl/3.2.1/wstx-asl-3.2.1.jar" sourcepath="M2_REPO/org/codehaus/woodstox/wstx-asl/3.2.1/wstx-asl-3.2.1-sources.jar"/>
                          <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
                        </classpath>

                         

                        Here is an update I got from Jason Van Zyl to a (now closed) JIRA issue I opened regarding this same topic in this thread:

                         

                        The maven-eclipse-plugin is not supported. Any problems are with  configurators so report what is missing. You won't be able to sue mvn  eclipse:eclipse with M2Eclipse 1.0.

                        • 9. Re: build path not set correctly after importing from svn for mavenized Seam project
                          Max Rydahl Andersen Master

                          yes, the problem is that mvn eclipse:eclipse doesn't work reliably well. I don't even think it is capable of resolving projects with a different name than its module directory name (i.e moduleA should be named moduleA-<version> for your scenario to work)

                           

                          Thus try use m2eclipse instead which supports importing with different styled names.