Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.0-rc-4
    • Fix Version/s: 1.0-rc-5
    • Component/s: stub generation
    • Labels:
      None
    • Environment:
      -
    • Number of attachments :
      0

      Description

      Here is the error (the stack trace is unimportant):
      java.lang.InternalError: Stubbed method

      What's happening is that if you use the maven-source-plugin, or I believe, the maven-javadoc-plugin, Maven forks the lifecycle, and stubs are regenerated, but compile is not run again. I believe this is making the stubs have a later date than the .class files. So the next time you go through a non-clean compile, Java will compile the stubs, but the GMaven plugin, being very smart and knowing that it does not need to recompile, leaves the stub-compiled .class files in place.

      This only happens if the lifecycle forks.

      I don't have a fix, but I do have a workaround. Here is my POM markup with a Groovy script execution to fix this issue temporarily.

                  <plugin>
                      <groupId>org.codehaus.groovy.maven</groupId>
                      <artifactId>gmaven-plugin</artifactId>
                      <version>1.0-rc-4</version>
                      <dependencies>
                          <dependency>
                              <groupId>org.codehaus.groovy.maven.runtime</groupId>
                              <artifactId>gmaven-runtime-1.5</artifactId>
                              <version>1.0-rc-4</version>
                              <exclusions>
                                  <exclusion>
                                      <groupId>org.codehaus.groovy</groupId>
                                      <artifactId>groovy-all-minimal</artifactId>
                                  </exclusion>
                              </exclusions>                       
                          </dependency>
                          <dependency>
                              <groupId>org.codehaus.groovy</groupId>
                              <artifactId>groovy-all-minimal</artifactId>
                              <version>1.5.7</version>
                          </dependency>
                      </dependencies>  
                      <configuration>
                          <providerSelection>1.5</providerSelection>
                      </configuration> 
                      <executions>
                          <execution>
                              <goals>
                                  <goal>generateStubs</goal>
                                  <goal>compile</goal>
                                  <goal>generateTestStubs</goal>
                                  <goal>testCompile</goal>
                              </goals>
                          </execution>
                          <execution>
                              <id>Prevent Stub Compilation</id>
                              <phase>generate-sources</phase>
                              <goals><goal>execute</goal></goals>
                              <configuration>
                                  <source>
                                   <![CDATA[
                                      /*
                                       * This code marks the date of the groovy-stubs to sometime in 1969, which
                                       * prevents them from being compiled over the Groovy-copiled classes.
                                       * JIRA is filed.
                                       */
                                      project.compileSourceRoots.each 
                                      {String root ->
                                          File folder = new File(root).canonicalFile;
                                          if(folder.isDirectory() && folder.canonicalPath =~ /groovy-stubs/)
                                          {
                                              folder.eachFileRecurse 
                                              {File file ->
                                                  if(file.name.endsWith(".java"))
                                                  {
                                                      file.lastModified = 0;
                                                  }
                                              }
                                          }
                                      }
                                   ]]>
                                  </source>
                              </configuration>
                          </execution>
                      </executions> 
                  </plugin>
      

        Activity

        Hide
        Jason Smith added a comment -

        Setting lastModified() to 1970 on stub files prevents javac from overwriting class files previously compiled by groovyc. Treatment in revision 15412.

        Show
        Jason Smith added a comment - Setting lastModified() to 1970 on stub files prevents javac from overwriting class files previously compiled by groovyc. Treatment in revision 15412.

          People

          • Assignee:
            Jason Dillon
            Reporter:
            Jason Smith
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: