GMaven
  1. GMaven
  2. GMAVEN-55

GMaven should not cause m2eclipse to add extra classpath entry

    Details

    • Type: Bug Bug
    • Status: Open Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Number of attachments :
      0

      Description

      As described on the eclipse-plugin-dev mailing list, GMaven is adding an extra classpath entry to eclipse .classpath files when there are references between groovy and java files. From the mailing list:

      ====================

      Removing the .classpath entry should not be a problem - the new Groovy plugin doesn't need it. The entry is likely added when m2eclipse is asked to update project configuration and it goes through the various plugin goals that are bound to the "generate-sources" phase (as is the GenerateStubsMojo). This goal has a method getOutputDirectory() that returns this path.

      /**

      • Generate Java stubs from Groovy sources.
        *
      • @goal generateStubs
      • @phase generate-sources
      • @requiresDependencyResolution compile
      • @since 1.0-beta-2
        *
      • @version $Id: GenerateStubsMojo.java 8 2009-07-16 09:15:04Z user57 $
      • @author <a href="mailto:jason@planet57.com">Jason Dillon</a>
        */
        public class GenerateStubsMojo
        extends AbstractGenerateStubsMojo
        {
        /**
      • The directory where generated Java stub files will be placed.
        *
      • @parameter default-value="$ {project.build.directory}

        /generated-sources/groovy-stubs/main"

      • @required
      • @noinspection UnusedDeclaration
        */
        private File outputDirectory;

      protected List getProjectClasspathElements() throws DependencyResolutionRequiredException

      { return project.getCompileClasspathElements(); }

      protected File getOutputDirectory()

      { return outputDirectory; }

      ....

        Activity

        Hide
        Reiner Saddey added a comment -

        I've devised a work-around that uses profiles to selectively enable/disable stub generation.

        • Remove all GMaven <execution> stuff from your <plugins> and/or <pluginManagement> and then set it according to whether the pom is "executed" from either within GMaven or not.
        • Use Eclipse GMaven Project Properties Page to specifically enable the "eclipse" profile (which in turn will disable the notEclipse one).
              <profiles>
                  <profile>
                      <!-- Eclipse: just compile, don't stub -->
                      <id>eclipse</id>
                      <build>
                          <pluginManagement>
                              <plugins>
                                  <plugin>
                                      <groupId>org.codehaus.gmaven</groupId>
                                      <artifactId>gmaven-plugin</artifactId>
                                      <executions>
                                          <execution>
                                              <goals>
                                                  <!--<goal>generateStubs</goal> -->
                                                  <goal>compile</goal>
                                                  <!-- <goal>generateTestStubs</goal> -->
                                                  <!-- <goal>testCompile</goal> -->
                                              </goals>
                                          </execution>
                                      </executions>
                                  </plugin>
                              </plugins>
                          </pluginManagement>
                      </build>
                  </profile>
                  <profile>
                      <!-- not Eclipse: both stub and compile -->
                      <id>notEclipse</id>
                      <activation>
                          <activeByDefault>true</activeByDefault>
                      </activation>
                      <build>
                          <pluginManagement>
                              <plugins>
                                  <plugin>
                                      <groupId>org.codehaus.gmaven</groupId>
                                      <artifactId>gmaven-plugin</artifactId>
                                      <executions>
                                          <execution>
                                              <goals>
                                                  <goal>generateStubs</goal>
                                                  <goal>compile</goal>
                                                  <!-- <goal>generateTestStubs</goal> -->
                                                  <!-- <goal>testCompile</goal> -->
                                              </goals>
                                          </execution>
                                      </executions>
                                  </plugin>
                              </plugins>
                          </pluginManagement>
                      </build>
                  </profile>
              </profiles>
          
        Show
        Reiner Saddey added a comment - I've devised a work-around that uses profiles to selectively enable/disable stub generation. Remove all GMaven <execution> stuff from your <plugins> and/or <pluginManagement> and then set it according to whether the pom is "executed" from either within GMaven or not. Use Eclipse GMaven Project Properties Page to specifically enable the "eclipse" profile (which in turn will disable the notEclipse one). <profiles> <profile> <!-- Eclipse: just compile, don't stub --> <id>eclipse</id> <build> <pluginManagement> <plugins> <plugin> <groupId>org.codehaus.gmaven</groupId> <artifactId>gmaven-plugin</artifactId> <executions> <execution> <goals> <!--<goal>generateStubs</goal> --> <goal>compile</goal> <!-- <goal>generateTestStubs</goal> --> <!-- <goal>testCompile</goal> --> </goals> </execution> </executions> </plugin> </plugins> </pluginManagement> </build> </profile> <profile> <!-- not Eclipse: both stub and compile --> <id>notEclipse</id> <activation> <activeByDefault>true</activeByDefault> </activation> <build> <pluginManagement> <plugins> <plugin> <groupId>org.codehaus.gmaven</groupId> <artifactId>gmaven-plugin</artifactId> <executions> <execution> <goals> <goal>generateStubs</goal> <goal>compile</goal> <!-- <goal>generateTestStubs</goal> --> <!-- <goal>testCompile</goal> --> </goals> </execution> </executions> </plugin> </plugins> </pluginManagement> </build> </profile> </profiles>

          People

          • Assignee:
            Unassigned
            Reporter:
            Andrew Eisenberg
          • Votes:
            2 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated: