4 Replies Latest reply on Jun 19, 2009 2:49 AM by thomas.diesler

    Using MAVEN2_CLASSPATH_CONTAINER

    thomas.diesler

      Folks,

      I noticed that the kernel eclipse setup does not leverage the projects dependencies defined by the pom.

      Instead of manually maintaining the dependency list like this

      <classpath>
       <classpathentry kind="src" path="src/main/java"/>
       <classpathentry kind="src" path="src/main/resources" excluding="**/*.java"/>
       <classpathentry kind="src" path="src/test/java" output="target/test-classes"/>
       <classpathentry kind="src" path="src/test/resources" output="target/test-classes" excluding="**/*.java"/>
       <classpathentry kind="output" path="target/classes"/>
       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
       <classpathentry kind="var" path="M2_REPO/javax/activation/activation/1.1.1/activation-1.1.1.jar"/>
       <classpathentry kind="var" path="M2_REPO/org/apache/ant/ant/1.7.0/ant-1.7.0.jar"/>
       <classpathentry kind="var" path="M2_REPO/org/apache/ant/ant-junit/1.7.0/ant-junit-1.7.0.jar"/>
       <classpathentry kind="var" path="M2_REPO/org/apache/ant/ant-launcher/1.7.0/ant-launcher-1.7.0.jar"/>
       <classpathentry kind="var" path="M2_REPO/wutka-dtdparser/dtdparser121/1.2.1/dtdparser121-1.2.1.jar"/>
       <classpathentry kind="var" path="M2_REPO/sun-jaxb/jaxb-api/2.1.4/jaxb-api-2.1.4.jar" sourcepath="M2_REPO/sun-jaxb/jaxb-api/2.1.4/jaxb-api-2.1.4-sources.jar"/>
       <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-common-core/2.2.13.GA/jboss-common-core-2.2.13.GA.jar" sourcepath="M2_REPO/org/jboss/jboss-common-core/2.2.13.GA/jboss-common-core-2.2.13.GA-sources.jar"/>
       <classpathentry kind="src" path="/jboss-dependency"/>
       <classpathentry kind="src" path="/jboss-kernel"/>
       <classpathentry kind="var" path="M2_REPO/org/jboss/logging/jboss-logging-log4j/2.0.5.GA/jboss-logging-log4j-2.0.5.GA.jar" sourcepath="M2_REPO/org/jboss/logging/jboss-logging-log4j/2.0.5.GA/jboss-logging-log4j-2.0.5.GA-sources.jar"/>
       <classpathentry kind="var" path="M2_REPO/org/jboss/logging/jboss-logging-spi/2.0.5.GA/jboss-logging-spi-2.0.5.GA.jar" sourcepath="M2_REPO/org/jboss/logging/jboss-logging-spi/2.0.5.GA/jboss-logging-spi-2.0.5.GA-sources.jar"/>
       <classpathentry kind="var" path="M2_REPO/org/jboss/man/jboss-managed/2.1.0.CR8/jboss-managed-2.1.0.CR8.jar" sourcepath="M2_REPO/org/jboss/man/jboss-managed/2.1.0.CR8/jboss-managed-2.1.0.CR8-sources.jar"/>
       <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-mdr/2.0.1.GA/jboss-mdr-2.0.1.GA.jar" sourcepath="M2_REPO/org/jboss/jboss-mdr/2.0.1.GA/jboss-mdr-2.0.1.GA-sources.jar"/>
       <classpathentry kind="var" path="M2_REPO/org/jboss/man/jboss-metatype/2.1.0.CR8/jboss-metatype-2.1.0.CR8.jar" sourcepath="M2_REPO/org/jboss/man/jboss-metatype/2.1.0.CR8/jboss-metatype-2.1.0.CR8-sources.jar"/>
       <classpathentry kind="var" path="M2_REPO/jboss/profiler/jvmti/jboss-profiler-jvmti/1.0.0.CR5/jboss-profiler-jvmti-1.0.0.CR5.jar"/>
       <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-reflect/2.0.2.GA/jboss-reflect-2.0.2.GA.jar" sourcepath="M2_REPO/org/jboss/jboss-reflect/2.0.2.GA/jboss-reflect-2.0.2.GA-sources.jar"/>
       <classpathentry kind="var" path="M2_REPO/org/jboss/jbossas/jboss-server-manager/0.1.1.GA/jboss-server-manager-0.1.1.GA.jar" sourcepath="M2_REPO/org/jboss/jbossas/jboss-server-manager/0.1.1.GA/jboss-server-manager-0.1.1.GA-sources.jar"/>
       <classpathentry kind="var" path="M2_REPO/org/jboss/test/jboss-test/1.1.1.GA/jboss-test-1.1.1.GA.jar" sourcepath="M2_REPO/org/jboss/test/jboss-test/1.1.1.GA/jboss-test-1.1.1.GA-sources.jar"/>
       <classpathentry kind="var" path="M2_REPO/org/jboss/jbossxb/2.0.1.GA/jbossxb-2.0.1.GA.jar" sourcepath="M2_REPO/org/jboss/jbossxb/2.0.1.GA/jbossxb-2.0.1.GA-sources.jar"/>
       <classpathentry kind="var" path="M2_REPO/junit/junit/4.4/junit-4.4.jar" sourcepath="M2_REPO/junit/junit/4.4/junit-4.4-sources.jar"/>
       <classpathentry kind="var" path="M2_REPO/apache-log4j/log4j/1.2.14/log4j-1.2.14.jar" sourcepath="M2_REPO/apache-log4j/log4j/1.2.14/log4j-1.2.14-sources.jar"/>
       <classpathentry kind="var" path="M2_REPO/apache-xerces/xercesImpl/2.9.1/xercesImpl-2.9.1.jar"/>
       <classpathentry kind="var" path="M2_REPO/apache-xerces/xml-apis/2.9.1/xml-apis-2.9.1.jar"/>
      </classpath>
      


      it would be possible to delegate to the eclipse maven plugin, like this

      <classpath>
       <classpathentry kind="src" output="target/classes" path="src/main/java"/>
       <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
       <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
       <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/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>
      


      in which case eclipse reads the dependencies from the pom.


        • 1. Re: Using MAVEN2_CLASSPATH_CONTAINER
          wolfc

          I would also say to make an eclipse profile mandatory which puts the classes in 'eclipse-target/...' instead of 'target'. I've seen some cases where JDT would create class files that where wrong and those ended up in the (snapshot) repository.

          <build>
           <!-- based on the profile we switch directories -->
           <outputDirectory>${myproject.outputDirectory}</outputDirectory>
           <testOutputDirectory>${myproject.testOutputDirectory}</testOutputDirectory>
           </build>
          
           <profiles>
           <!--
           To make sure we don't end up with Eclipse compiled classes
           in the repo we use different output directories when running
           under Eclipse.
           -->
           <profile>
           <id>default</id>
           <activation>
           <activeByDefault>true</activeByDefault>
           </activation>
           <properties>
           <myproject.outputDirectory>target/classes</myproject.outputDirectory>
           <myproject.testOutputDirectory>
           target/test-classes
           </myproject.testOutputDirectory>
           </properties>
           </profile>
          
           <profile>
           <id>eclipse</id>
           <build>
           <defaultGoal>process-test-resources</defaultGoal>
           <plugins>
           <plugin>
           <artifactId>maven-eclipse-plugin</artifactId>
           <version>2.6</version>
           <configuration>
           <downloadSources>true</downloadSources>
           <buildOutputDirectory>eclipse-target/classes</buildOutputDirectory>
           </configuration>
           </plugin>
           </plugins>
           </build>
           <properties>
           <myproject.outputDirectory>eclipse-target/classes</myproject.outputDirectory>
           <myproject.testOutputDirectory>
           eclipse-target/test-classes
           </myproject.testOutputDirectory>
           </properties>
           </profile>
           </profiles>


          • 2. Re: Using MAVEN2_CLASSPATH_CONTAINER
            kabirkhan

             

            "thomas.diesler@jboss.com" wrote:

            Instead of manually maintaining the dependency list like this

            It's not manually maintained, it is generated using
            mvn eclipse:eclipse
            


            "thomas.diesler@jboss.com" wrote:

            it would be possible to delegate to the eclipse maven plugin, like this
            ...
            in which case eclipse reads the dependencies from the pom.

            Ales won't care since he uses IntelliJ, but if others need to do work on kernel for whatever reason, while nice, I am not sure we want to force people to install the eclipse maven plugin?

            • 3. Re: Using MAVEN2_CLASSPATH_CONTAINER
              kabirkhan

               

              "wolfc" wrote:
              I would also say to make an eclipse profile mandatory which puts the classes in 'eclipse-target/...' instead of 'target'. I've seen some cases where JDT would create class files that where wrong and those ended up in the (snapshot) repository.


              This seems to already be there, to update the .classpath files run

              $mvn -Peclipse eclipse:eclipse

              • 4. Re: Using MAVEN2_CLASSPATH_CONTAINER
                thomas.diesler

                ok thanks, that works for me