Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Source change detection #55

Open
moonfruit opened this issue Apr 13, 2016 · 2 comments
Open

Source change detection #55

moonfruit opened this issue Apr 13, 2016 · 2 comments
Assignees

Comments

@moonfruit
Copy link

I use GMavenPlus for my project for joint compilation.

In the pure java module, when I run mvn package, if there is nothing changed in the module, the artifact is still the one I built last time.

But when I use GMavenPlus, the artifact is built every time that I run mvn package, even nothing has been changed.

So, is there a way for GMavenPlus to detect source changes. For example, when .class file's mtime is newer than the .groovy file's mtime, do not compile the one.

Here is my pom.xml plugin part:

<plugin>
    <groupId>org.codehaus.gmavenplus</groupId>
    <artifactId>gmavenplus-plugin</artifactId>
    <version>1.5</version>
    <executions>
        <execution>
            <goals>
                <goal>addSources</goal>
                <goal>addTestSources</goal>
                <goal>generateStubs</goal>
                <goal>compile</goal>
                <goal>testGenerateStubs</goal>
                <goal>testCompile</goal>
                <goal>removeStubs</goal>
                <goal>removeTestStubs</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <invokeDynamic>true</invokeDynamic>
    </configuration>
</plugin>
@keeganwitt
Copy link
Member

Hmm. That would be really cool. That functionality isn't built into the Groovy compiler, so I'd have to do something custom. I'll poke around in the Maven Compiler Plugin and see what they are doing to provide this functionality. Maybe we could do something similar.

@keeganwitt keeganwitt self-assigned this Apr 23, 2016
@moonfruit
Copy link
Author

moonfruit commented Apr 24, 2016

@keeganwitt

I already seek solution in the GMavenPlus.
I found that the compilation like this:

  1. generate groovy stubs for java
  2. use maven-compiler-plugin compile with normal java sources and stubs into classes
  3. use groovyc compile groovy sources into classes and override previous step classes

So, the problem is cannot use classes newer than groovy sources to detect source changes. Because when the compilation process is break between step 2 and step 3, the next time we start the process, the plugin will believe that the source is already built.

And when the plugin use the the stubs newer than groovy sources to detect source changes, we face the same problem.

Unless the the plugin knows the class is built by stub or groovy source, I think this idea can not be achieved.

I expect that you can find a better solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants