Comments (17)
Ah right. I know what's wrong, but unfortunately I'm not sure how to fix it properly.
The commit that caused the regression was dc1076e, and the problem is that sources are (probably) generated during the compile
phase which comes after generate-resources
, and even after process-resources
.
One possible fix would be to partially revert the commit, but exclude those compile source roots that are already included as resources (using the same conflict-detection as in import-sources
which avoid declaring resources for source roots that are already included as resources), on the principle that generated sources are very unlikely to be subject to filtering or relocation (and if that's what one wants, he'd have to generate them during the generate-sources
phase, e.g. calling compile:compiler
with <proc>only</proc>
).
Anyway, time to add an integration test for that that'll serve as a non-regression test.
Thanks for the report.
from gwt-maven-plugin.
Oh crap, the above wouldn't work for gwt-lib
packaging unless I replace the use of jar:jar
with a custom mojo. Maven is driving me insane, once again…
from gwt-maven-plugin.
Workaround: use resources:copy-resources
at process-classes
phase (or later). You don't actually need the build-helper-maven-plugin
when building (but it'll be handy for gwt:devmode
/ gwt:codeserver
).
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.7</version>
<executions>
<execution>
<id>add-generated-sources</id>
<phase>process-classes</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.outputDirectory}</outputDirectory>
<resources>
<resource>
<directory>${project.build.directory}/generated-sources/annotations</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
…or generate sources at generate-sources
phase (see previous comment)
from gwt-maven-plugin.
FWIW, another workaround is to postpone resources:resources
to the process-classes
phase. See in https://github.com/google/auto/blob/1ba4c40596f887f5040a60cd407b94751d65589f/value/src/it/gwtserializer/pom.xml#L102-L113 how I postponed resources:testResources
to the process-test-classes
phase.
That said, I think I'll add two new mojos to copy generated sources at process-classes
(or maybe prepare-package
) and process-test-classes
. That'll work for both gwt-lib
and gwt-app
.
from gwt-maven-plugin.
The workaround with resources:copy-resources
works for me. Thanks @tbroyer!
from gwt-maven-plugin.
Finally got to fix it by reworking the import-sources
and import-test-sources
mojos (d80bc8d) and added integration tests for annotation processing (259960d).
Would you mind testing with the latest snapshot?
(note that the sources are now copied –similarly to resources:copy-resources
– during the process-classes
phase, so if you need build-helper-maven-plugin
to add the generated sources as source roots you might have to bind it to the compile
phase to make it run before gwt:import-sources
, but after compile:compile
; in the integration tests I used a recent version of the maven-compiler-plugin
that automatically does that, but it has a bug when re-running the compilation without cleaning; this is not a problem for integration tests but might be a blocker for anyone trying to do "real things" with Maven)
from gwt-maven-plugin.
Nice job
from gwt-maven-plugin.
The latest snapshot works for my setup.
from gwt-maven-plugin.
It took me way too long, but I'm finally releasing a 1.0-rc-6 (should appear in Central soon)
from gwt-maven-plugin.
Should this be working with 1.0-rc-6 ? Using that version to package a gwt-lib, sources from stuff generated by APT don't end up in my jar.
from gwt-maven-plugin.
@chris-becker Yes it should; but you have to make sure your generated sources are added as source roots (i.e. either use maven-compiler-plugin 3.5.1 or greater –technically 3.2 or greater, but 3.2 to 3.5 are basically unusable when doing annotation processing due to MCOMPILER-235–, or use the build-helper-maven-plugin's add-source
goal)
from gwt-maven-plugin.
Doesn't work for me, see enclosed repo:
repo.zip
In maven's log, gwt-maven-plugin:1.0-rc-6:import-sources runs pretty early, right after build-helper-maven-plugin:1.12:add-source (which doesn't seem to have anything to add yet :), and way before maven-compiler-plugin:3.6.0:compile :
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ repo ---
[INFO] Deleting C:\Develop\IProjects\bpm\repo\target
[INFO]
[INFO] --- gwt-maven-plugin:1.0-rc-6:enforce-encoding (default-enforce-encoding) @ repo ---
[INFO]
[INFO] --- gwt-maven-plugin:1.0-rc-6:add-super-sources (default-add-super-sources) @ repo ---
[INFO]
[INFO] --- gwt-maven-plugin:1.0-rc-6:add-test-super-sources (default-add-test-super-sources) @ repo ---
[INFO]
[INFO] --- build-helper-maven-plugin:1.12:add-source (add-source) @ repo ---
[INFO] Source directory: C:\Develop\IProjects\bpm\repo\target\generated-sources\annotations added.
[INFO]
[INFO] --- gwt-maven-plugin:1.0-rc-6:import-sources (default-import-sources) @ repo ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] skip non existing resourceDirectory C:\Develop\IProjects\bpm\repo\target\generated-sources\annotations
[INFO]
[INFO] --- gwt-maven-plugin:1.0-rc-6:generate-module (default-generate-module) @ repo ---
[INFO]
[INFO] --- gwt-maven-plugin:1.0-rc-6:generate-module-metadata (default-generate-module-metadata) @ repo ---
[INFO]
[INFO] --- maven-resources-plugin:3.0.1:resources (default-resources) @ repo ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] skip non existing resourceDirectory C:\Develop\IProjects\bpm\repo\src\main\super
[INFO]
[INFO] --- maven-compiler-plugin:3.6.0:compile (default-compile) @ repo ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to C:\Develop\IProjects\bpm\repo\target\classes
[INFO]
[INFO] --- gwt-maven-plugin:1.0-rc-6:import-test-sources (default-import-test-sources) @ repo ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Develop\IProjects\bpm\repo\src\test\java
[INFO]
[INFO] --- maven-resources-plugin:3.0.1:testResources (default-testResources) @ repo ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Develop\IProjects\bpm\repo\src\test\resources
[INFO] skip non existing resourceDirectory C:\Develop\IProjects\bpm\repo\src\test\super
[INFO]
[INFO] --- maven-compiler-plugin:3.6.0:testCompile (default-testCompile) @ repo ---
[INFO] No sources to compile
[INFO]
[INFO] --- gwt-maven-plugin:1.0-rc-6:test (default-test) @ repo ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-jar-plugin:3.0.2:jar (default-jar) @ repo ---
[INFO] Building jar: C:\Develop\IProjects\bpm\repo\target\repo-0.0.1-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
from gwt-maven-plugin.
OK, so I reproduce the issue with your repro-case, and I understand why it happens (I only moved the import-sources
goal to process-classes
in the gwt-app
packaging, not the gwt-lib
one).
…and it didn't get caught in the IT tests because the maven-compiler-plugin changes its behavior depending on the source
configuration (which was left to its 1.5
default value) and won't pass a -s
argument to JavaC, therefore writing the generated source files alongside the class files, so they were packaged in the JAR, generating a false positive for the verification script.
Workarounds above should apply, but I think I'll overhaul the whole sources processing (i.e. remove it) and use a custom jar
goal: part of the rationale was that you could "filter" your sources by declaring them as resources too, but if you need that you should actually use the templating-maven-plugin to pre-process sources rather than post-process them. And with the proper processing order in that new goal I should be able to provide the same behavior as currently (when it works correctly) and avoid breaking the (hypothetical) projects that could use that feature.
from gwt-maven-plugin.
Cool !
My current workaround is using the maven-processor-plugin to move annotation processing before import-sources (thanks, @ibaca ;):
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.0</version>
<configuration>
<proc>none</proc>
</configuration>
</plugin>
<plugin>
<groupId>org.bsc.maven</groupId>
<artifactId>maven-processor-plugin</artifactId>
<version>2.2.4</version>
<executions>
<execution>
<goals>
<goal>process</goal>
</goals>
<configuration>
<outputDirectory>target/generated-sources/annotations</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
from gwt-maven-plugin.
Test fixed in 9a599a1, code fixed in 8295cc1.
@chris-becker Would you mind testing with 1.0-SNAPSHOT
? (available from the https://oss.sonatype.org/content/repositories/snapshots/
repository)
from gwt-maven-plugin.
Works... !
Had to remove above workaround, though: While that's in place I get the sources, but not the generated classes in my lib ;)
from gwt-maven-plugin.
FWIW, I finally did the refactoring suggested in #40 (comment) (shipped in 1.0-rc-7), though I forgot to take into account the source roots in the staleness check (this isn't a problem when editing a Java file, as it'll be recompiled, leading to an updated *.class
file that will re-trigger the compilation; but it won't recompile if you change a non-Java file in a source root, such as a *.ui.xml
file in src/main/java
).
edit: fixed in 0507e6d
from gwt-maven-plugin.
Related Issues (20)
- Is 2.9.0 ready? HOT 5
- Compile gwt-app to jar instead of war? HOT 1
- Version 1.0.0 do not support GWT 2.1.0 HOT 5
- Lombok not working with codeserver HOT 2
- Custom Linkers? HOT 2
- Source path from Inherited GWT.xml files are not being considered HOT 13
- GWT compilation failing with error, tried upgrading guice to 4.0 from 3.0 HOT 3
- Integration with GWT Eclipse Plugin seems partially broken HOT 6
- GWT 2.9.0 HOT 2
- GWT Multimodule modulename specificaiton HOT 1
- Redirected gwt artifacts cause a NPE when generating modules HOT 4
- Cannot compile GWT project using com.google.gwt:2.10.0-new-groupid-2 HOT 4
- API incompatibility issue with version 1.0.1 HOT 2
- Change default structure? HOT 2
- java process doesn't start. HOT 1
- Critical CVEs detected in transitive jar dependencies. HOT 1
- Validation warning, plugin should declare these Maven artifacts in `provided` scope HOT 1
- Upgrade to GWT 2.10.0 HOT 3
- goal codeserver fails when web app dependencies are managed in a BOM pom HOT 3
- [Question] How can i activate the debug logging ? because i keep getting the 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 HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gwt-maven-plugin.