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

annotation processor support #27

Closed
natros opened this issue Jul 6, 2015 · 8 comments
Closed

annotation processor support #27

natros opened this issue Jul 6, 2015 · 8 comments

Comments

@natros
Copy link

natros commented Jul 6, 2015

Hello,

I'm trying to use your plugin with an annotation processor (mapstruct -- http://mapstruct.org/). It seems to me that the plugin is not picking up the generated code.

[INFO] --- gwt-maven-plugin:1.0-rc-1:compile (default-compile) @ gwtapp ---
[INFO] Compiling module pt.ipb.tests.gwtapp.Main
[INFO] Ignored 1 unit with compilation errors in first pass.
[INFO] Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors.
[INFO] Finding entry point classes
[INFO] Tracing compile failure path for type 'pt.ipb.tests.gwtapp.client.Main'
[INFO] [ERROR] Errors in 'file:/Users/fsousa/Projects/tmp/gwtapp/src/main/java/pt/ipb/tests/gwtapp/client/Main.java'
[INFO] [ERROR] Line 9: No source code is available for type pt.ipb.tests.gwtapp.client.MyMapperImpl; did you forget to inherit a required module?
[INFO] [ERROR] Hint: Check the inheritance chain from your module; it may not be inheriting a required module or a module may not be adding its source path entries properly

I have a sample project here https://github.com/natros/gwtapp

Thank you

@hpehl
Copy link

hpehl commented Jul 6, 2015

What if you add the generated code using the build-helper maven plugin? I have a similar setup and added the following plugin configuration

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>build-helper-maven-plugin</artifactId>
    <executions>
        <execution>
            <id>add-source</id>
            <phase>prepare-package</phase>
            <goals>
                <goal>add-source</goal>
            </goals>
            <configuration>
                <sources>
                    <source>${project.build.directory}/generated-sources/annotations</source>
                </sources>
            </configuration>
        </execution>
    </executions>
</plugin>

Replace ${project.build.directory}/generated-sources/annotations in case your code is generated to a different folder.

@natros
Copy link
Author

natros commented Jul 6, 2015

Done that. It's not working :(

[INFO]    Finding entry point classes
[INFO]       Tracing compile failure path for type 'pt.ipb.tests.gwtapp.client.Main'
[INFO]          [ERROR] Errors in 'file:/Users/fsousa/Projects/tmp/gwtapp/src/main/java/pt/ipb/tests/gwtapp/client/Main.java'
[INFO]             [ERROR] Line 9: No source code is available for type pt.ipb.tests.gwtapp.client.MyMapperImpl; did you forget to inherit a required module?
[INFO]       [ERROR] Hint: Check the inheritance chain from your module; it may not be inheriting a required module or a module may not be adding its source path entries properly

@tbroyer
Copy link
Owner

tbroyer commented Jul 7, 2015

The way it's declared in your POM, gwt:compile is executed before build-helper:add-source (they're bound to the same phase, so Maven uses the document order, and you put gwt-maven-plugin before build-helper-maven-plugin).

Changing build-helper:add-source to run at process-classes fixes it. That also makes it possible to use gwt:devmode (which only runs up to the process-classes phase, so prepare-package definitely is too late).

Upgrading the maven-compiler-plugin to 3.2 would also fix it, without the need for the build-helper-maven-plugin, if it weren't for nasty side-effects (read: it's totally broken, stay with 3.1): https://issues.apache.org/jira/browse/MCOMPILER-235

@tbroyer tbroyer closed this as completed Jul 7, 2015
@tbroyer tbroyer added the invalid This doesn't seem right label Jul 7, 2015
@natros
Copy link
Author

natros commented Jul 7, 2015

Now I'm able to compile but I still can't run gwt:devmode

 mvn gwt:devmode 
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building gwtapp 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] >>> gwt-maven-plugin:1.0-rc-1:devmode (default-cli) > process-classes @ gwtapp >>>
[INFO] 
[INFO] --- gwt-maven-plugin:1.0-rc-1:enforce-encoding (default-enforce-encoding) @ gwtapp ---
[INFO] 
[INFO] --- gwt-maven-plugin:1.0-rc-1:add-super-sources (default-add-super-sources) @ gwtapp ---
[INFO] 
[INFO] --- gwt-maven-plugin:1.0-rc-1:add-test-super-sources (default-add-test-super-sources) @ gwtapp ---
[INFO] 
[INFO] --- gwt-maven-plugin:1.0-rc-1:import-sources (default-import-sources) @ gwtapp ---
[INFO] 
[INFO] --- gwt-maven-plugin:1.0-rc-1:generate-module (default-generate-module) @ gwtapp ---
[INFO] /Users/fsousa/Projects/tmp/gwtapp/target/classes/pt/ipb/tests/gwtapp/Main.gwt.xml up to date - skipping
[INFO] 
[INFO] --- maven-resources-plugin:2.7:resources (default-resources) @ gwtapp ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] skip non existing resourceDirectory /Users/fsousa/Projects/tmp/gwtapp/src/main/super
[INFO] Copying 4 resources
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ gwtapp ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- build-helper-maven-plugin:1.9.1:add-source (add-source) @ gwtapp ---
[INFO] Source directory: /Users/fsousa/Projects/tmp/gwtapp/target/generated-sources/annotations added.
[INFO] 
[INFO] <<< gwt-maven-plugin:1.0-rc-1:devmode (default-cli) < process-classes @ gwtapp <<<
[INFO] 
[INFO] --- gwt-maven-plugin:1.0-rc-1:devmode (default-cli) @ gwtapp ---
[INFO] Super Dev Mode starting up
[INFO]    workDir: /Users/fsousa/Projects/tmp/gwtapp/target/gwt/devmode/work
[INFO]    Loading Java files in pt.ipb.tests.gwtapp.Main.
[INFO]    Ignored 1 unit with compilation errors in first pass.
[INFO] Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors.
[INFO]    Finding entry point classes
[INFO]       Tracing compile failure path for type 'pt.ipb.tests.gwtapp.client.Main'
[INFO]          [ERROR] Errors in 'file:/Users/fsousa/Projects/tmp/gwtapp/src/main/java/pt/ipb/tests/gwtapp/client/Main.java'
[INFO]             [ERROR] Line 9: No source code is available for type pt.ipb.tests.gwtapp.client.MyMapperImpl; did you forget to inherit a required module?
[INFO]       [ERROR] Hint: Check the inheritance chain from your module; it may not be inheriting a required module or a module may not be adding its source path entries properly
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------

@tbroyer
Copy link
Owner

tbroyer commented Jul 7, 2015

I'll have a look. I think I know what's going on.

@tbroyer tbroyer reopened this Jul 7, 2015
@tbroyer tbroyer closed this as completed in 0068d0c Jul 9, 2015
@tbroyer
Copy link
Owner

tbroyer commented Jul 9, 2015

I'll cut an RC 2 soon with the fix, but if you could try the snapshot in the mean time and tell me if it fixes the issue for you (I tried it with your project and it worked for me)

@natros
Copy link
Author

natros commented Jul 9, 2015

It's working with both devmode and codeserver.

Thank you Thomas.

@tbroyer tbroyer removed the invalid This doesn't seem right label Jul 11, 2015
@tbroyer
Copy link
Owner

tbroyer commented Jul 11, 2015

Just released 1.0-rc-2.

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

No branches or pull requests

3 participants