[ 
http://jira.codehaus.org/browse/MGROOVY-187?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jason Dillon updated MGROOVY-187:
---------------------------------

    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.

{code}
            <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>
{code}

  was:
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>


> Stubs are being compiled into artifacts.
> ----------------------------------------
>
>                 Key: MGROOVY-187
>                 URL: http://jira.codehaus.org/browse/MGROOVY-187
>             Project: GMaven
>          Issue Type: Bug
>          Components: stub generation
>    Affects Versions: 1.0-rc-4
>         Environment: -
>            Reporter: Jason Smith
>            Assignee: Jason Dillon
>
> 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.
> {code}
>             <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>
> {code}

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to