tbroyer / gwt-maven-plugin

Starting fresh on building GWT projects with Maven
https://tbroyer.github.io/gwt-maven-plugin/
Apache License 2.0
167 stars 39 forks source link

Source path from Inherited GWT.xml files are not being considered #144

Closed pratikthaker84 closed 3 years ago

pratikthaker84 commented 3 years ago

Hi Team,

I have below project structure

A

B

In B.gwt.xml I have below tag,

<inherits name="com.sample.gwt.A" />

In the module tag in my pom.xml, I have provided com.sample.gwt.client.B

I am facing below issue,

While doing gwt compiling com.sample.gwt.client.B, it is not considering source path provided in A.gwt.xml and it is giving compilation errors in that.

We have similar build process with Ant, where it is working fine. Same way it is working fine by doing gwt compile from Eclipse.

Can you please suggest what we should do here ?

tbroyer commented 3 years ago

Run Maven with debug logs (mvn -X) and look for the Classpath: and Arguments: lines. You could then compare them to what your Ant build is doing, and you can run GWT from the command-line (or your IDE) with this classpath and arguments.

pratikthaker84 commented 3 years ago

Hi Thomas,

Thanks for the quick reply. I can see sources.jar file of the project A which contains A.gwt.xml in the Classpath:

I am not seeing anything with Arguments: word.

Also, I have provided below compiler arguments which matches with my Ant build arguments,

                <jvmArgs>-Xmx2048M -Xss1024M -Dgwt.usearchives=false</jvmArgs>
                <localWorkers>6</localWorkers>
                <logLevel>TRACE</logLevel>
                <optimize>9</optimize>
                <compilerArgs>
                        <arg>-XclosureCompiler</arg>
                        <arg>-XnocheckCasts</arg>
                        <arg>-XnoclassMetadata</arg>
                      </compilerArgs>

When I am adding the resource folder of Project A (which contains A.gwt.xml) than it starts doing gwt compile of A.gwt.xml which I do not want. FYI, I am using GWT 2.7.0

tbroyer commented 3 years ago

Arguments: should be the line following Classpath:: https://github.com/tbroyer/gwt-maven-plugin/blob/1.0.0/src/main/java/net/ltgt/gwt/maven/CommandLine.java#L49-L52

pratikthaker84 commented 3 years ago

Is there any way to stop autodetection of modules and only gwt compile B.gwt.xml ?

tbroyer commented 3 years ago

There is no auto-detection of modules in this plugin (there is in Mojo's plugin though), gwt:compile will only compile the module configured in <moduleName>.

Oh, BTW, jvmArgs is a list so it should be configured with child elements, same as compilerArgs.

pratikthaker84 commented 3 years ago

It was my mistake, by carefully looking into it i found that it was using old plugin.

It has been corrected. The only problem i am facing is in Classpath: or Arguments: i am not seeing resource folder of Project A

I already tried below tags,

<build>
        <resources>
            <resource>
                           <directory>${basedir}/src/main/resources</directory>
                         </resource>
                 </resources>
           </build>

I can see that the resource folder is there in classpath in Ant build

Any solution to have it available ?

tbroyer commented 3 years ago

It's expected, because resources have been copied already into target/classes, which is in the classpath. Resources could be filtered and/relocated, so they're not added directly to the classpath. If you need to make changes to resources and see them in dev mode, you have to run mvn process-resources to copy them again into target/classes.

pratikthaker84 commented 3 years ago

Do you mean i can add process-resources to existing goal gwt:compile ?

pratikthaker84 commented 3 years ago

Hi Thomas,

Thanks for the suggestions, i am now facing only 1 error mentioned below and I think you can sure help me in that.

Errors in 'jar:file:gwtx/1.5.2/gwtx-1.5.2.jar!/com/googlecode/gwtx/java/util/emul/java/util/regex/Pattern.java'
[INFO]          Line 183: Referencing class 'com.googlecode.gwtx.java.util.emul.java.util.regex.Pattern': unable to resolve class
tbroyer commented 3 years ago

There's indeed a bug in that file: https://github.com/google-code-export/gwtx/blob/gwtx-1.5.2/src/main/java/com/googlecode/gwtx/java/util/emul/java/util/regex/Pattern.java#L183 (that class is emulating java.util.regex.Pattern). Fixed in gwtx 1.5.3 apparently, but man this lib is nearly 12 years old :older_adult:

https://code.google.com/archive/p/gwtx/issues/22 https://code.google.com/archive/p/gwtx/issues/25 https://code.google.com/archive/p/gwtx/issues/29 https://github.com/google-code-export/gwtx/commit/da4e6a08ebffb22f8a6ee8385e9b981ba79bc44e

pratikthaker84 commented 3 years ago

Thanks for the quick reply.

It is indeed old.

Let's hope it works with 1.5.3. Will let you know

pratikthaker84 commented 3 years ago

It is failing with below error,

[ERROR] An internal compiler exception occurred
[INFO] com.google.gwt.dev.jjs.InternalCompilerException: Unexpected error during visit.
[INFO]  at com.google.gwt.dev.jjs.ast.JVisitor.translateException(JVisitor.java:121)
[INFO]  at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:296)
[INFO]  at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:285)
[INFO]  at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:128)
[INFO]  at com.google.gwt.dev.jjs.ast.JCastOperation.traverse(JCastOperation.java:67)
[INFO]  at com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:381)
[INFO]  at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:293)
[INFO]  at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:285)
[INFO]  at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:128)
[INFO]  at com.google.gwt.dev.jjs.ast.JBinaryOperation.traverse(JBinaryOperation.java:83)
[INFO]  at com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:381)
[INFO]  at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:293)
[INFO]  at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:285)
[INFO]  at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:128)
[INFO]  at com.google.gwt.dev.jjs.ast.JExpressionStatement.traverse(JExpressionStatement.java:42)
[INFO]  at com.google.gwt.dev.jjs.ast.JModVisitor$ListContext.traverse(JModVisitor.java:95)
[INFO]  at com.google.gwt.dev.jjs.ast.JModVisitor.acceptWithInsertRemove(JModVisitor.java:351)
[INFO]  at com.google.gwt.dev.jjs.ast.JBlock.traverse(JBlock.java:92)
[INFO]  at com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:381)
[INFO]  at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:293)
[INFO]  at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:149)
[INFO]  at com.google.gwt.dev.jjs.ast.JIfStatement.traverse(JIfStatement.java:53)
[INFO]  at com.google.gwt.dev.jjs.ast.JModVisitor$ListContext.traverse(JModVisitor.java:95)
[INFO]  at com.google.gwt.dev.jjs.ast.JModVisitor.acceptWithInsertRemove(JModVisitor.java:351)
[INFO]  at com.google.gwt.dev.jjs.ast.JBlock.traverse(JBlock.java:92)
[INFO]  at com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:381)
[INFO]  at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:293)
[INFO]  at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:149)
[INFO]  at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:145)
[INFO]  at com.google.gwt.dev.jjs.ast.JMethodBody.traverse(JMethodBody.java:83)
[INFO]  at com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:381)
[INFO]  at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:293)
[INFO]  at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:285)
[INFO]  at com.google.gwt.dev.jjs.ast.JMethod.visitChildren(JMethod.java:600)
[INFO]  at com.google.gwt.dev.jjs.ast.JMethod.traverse(JMethod.java:569)
[INFO]  at com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:381)
[INFO]  at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:293)
[INFO]  at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:285)
[INFO]  at com.google.gwt.dev.jjs.impl.UnifyAst.mainLoop(UnifyAst.java:1505)
[INFO]  at com.google.gwt.dev.jjs.impl.UnifyAst.exec(UnifyAst.java:870)
[INFO]  at com.google.gwt.dev.jjs.JavaToJavaScriptCompiler$Precompiler.unifyJavaAst(JavaToJavaScriptCompiler.java:1305)
[INFO]  at com.google.gwt.dev.jjs.JavaToJavaScriptCompiler$Precompiler.constructJavaAst(JavaToJavaScriptCompiler.java:1038)
[INFO]  at com.google.gwt.dev.jjs.JavaToJavaScriptCompiler$Precompiler.precompile(JavaToJavaScriptCompiler.java:954)
[INFO]  at com.google.gwt.dev.jjs.MonolithicJavaToJavaScriptCompiler.precompile(MonolithicJavaToJavaScriptCompiler.java:303)
[INFO]  at com.google.gwt.dev.jjs.JavaScriptCompiler.precompile(JavaScriptCompiler.java:38)
[INFO]  at com.google.gwt.dev.Precompile.precompile(Precompile.java:286)
[INFO]  at com.google.gwt.dev.Precompile.precompile(Precompile.java:229)
[INFO]  at com.google.gwt.dev.Precompile.precompile(Precompile.java:145)
[INFO]  at com.google.gwt.dev.Compiler.run(Compiler.java:206)
[INFO]  at com.google.gwt.dev.Compiler.run(Compiler.java:158)
[INFO]  at com.google.gwt.dev.Compiler$1.run(Compiler.java:120)
[INFO]  at com.google.gwt.dev.CompileTaskRunner.doRun(CompileTaskRunner.java:55)
[INFO]  at com.google.gwt.dev.CompileTaskRunner.runWithAppropriateLogger(CompileTaskRunner.java:50)
[INFO]  at com.google.gwt.dev.Compiler.main(Compiler.java:127)
[INFO] Caused by: java.lang.IllegalAccessError: tried to access method com.google.common.collect.MapMaker.makeComputingMap(Lcom/google/common/base/Function;)Ljava/util/concurrent/ConcurrentMap; from class com.google.inject.internal.Annotations$AnnotationChecker
[INFO]  at com.google.inject.internal.Annotations$AnnotationChecker.<init>(Annotations.java:104)
pratikthaker84 commented 3 years ago

Trying with guice 4.0, i was using 3.0