Requestfactory Validation on Multi-Project Setup - gwt

I tried changing to the release version of gwt2.4 and run into a problem. I use multiple projects in my setup. I have a project with serverside code, one project with shared code, that can be used in different gwt projects and a gwt project binding everything together. I build everything with maven. i followed the instructions for annotationprocessing found here:
http://code.google.com/p/google-web-toolkit/wiki/RequestFactoryInterfaceValidation
when I compile my shared project, where the proxies and services are, the folder "generated-sources\apt\" with the DeobfuscatorBuilder.java is created. I have the sources of this project as dependency of my mainproject and try to run the validator as well, but the DeobfuscatorBuilder.java is not created here. Everything compiles but when I invoke a call to the requestfactory I get the error:
com.google.web.bindery.requestfactory.server.UnexpectedException: No RequestContext for operation ZwI9iqZS626uTt_TFwRtUwPYSOE=
I guess there is an mistake in my setup, but I could't find where ..
Does anybody know how to solve this problem?
Regards
arne
UPDATE:
I added this to my pom:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack</id>
<phase>initialize</phase>
<goals>
<goal>unpack</goal>
<!-- <goal>build-classpath</goal> -->
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>com.myproject.core</groupId>
<artifactId>shared</artifactId>
<version>${shared.version}</version>
<classifier>sources</classifier>
<overWrite>true</overWrite>
<outputDirectory>${project.build.directory}/com.myproject.shared</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
This unpacks the sources of my dependencies and puts them into my target folder.
Then I added:
<configuration>
<sourceDirectory>target/com.fileee.shared</sourceDirectory>
</configuration>
to my processor-plugin.
This way it is not necessary to have all the projects in the workspace and it should work with a continous integration system. Wouldn't have figured that out without Andys reply though :)

I had the same issue and spent hours scouring the web for an answer without any luck. If I add the processor plugin to the shared project, it generates the DeobfuscatorBuilder class, but I get the same No RequestContext exception as you. If I just have the processsor plugin on the GWT war project, the builder isn't generated at all.
With a fair amount of trial and error I found adding the source directory from the shared project into the processor plugin configuration on the war project worked...
http://code.google.com/p/android-shuffle/source/browse/shuffle-app-engine/pom.xml#269
It's a bit dirty, but it does the trick. If there's an official method that doesn't require cross project hackery I'd be more than welcome to switch, but I haven't seen anything suggested yet.
Cheers
Andy

Related

AEM Communities Cleanup SRP - Bundle status is not Active

I cloned project from here. And I imported in eclipse as maven project and trying to build it using mvn clean install -DskipTests.
After deploying getting com.day.cq.commons- cannot resolve error in system console. For this I checked in depfinder there is already following dependency is present.
Please help me. I'm new in AEM.
Thank you.
I resolve above problem after importing following package in maven-bundle-plugin in pom.xml
<Import-Package>com.day.cq.commons;version=5.7.6;</Import-Package>
So, whole story will look like following:
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.5.0</version>
<extensions>true</extensions>
<inherited>true</inherited>
<configuration>
<obrRepository>NONE</obrRepository>
<instructions>
<Bundle-Category>social</Bundle-Category>
<Bundle-DocURL>
http://www.adobe.com
</Bundle-DocURL>
<Bundle-Vendor>Adobe Systems Inc.</Bundle-Vendor>
<Import-Package>com.day.cq.commons;version=5.7.6;</Import-Package>
</instructions>
</configuration>

Why is maven running the same pom differently on two computers?

Me and my workmate are trying to call the same Maven command (mvn site) on exactly the same pom and getting totally different output.
The code of which we think is going wrong, is the javadoc-plugin we added lately:
<!-- https://maven.apache.org/plugins/maven-javadoc-plugin/ -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${version.javadoc.plugin}</version>
<configuration>
<destDir>javadoc</destDir>
<charset>UTF-8</charset>
<docencoding>UTF-8</docencoding>
<doctitle>${project.name} API Documentation
${project.version}.${svn_revision}</doctitle>
<encoding>UTF-8</encoding>
<failonerror>false</failonerror>
<footer>Specification: ${specification.title}</footer>
<header>${project.name} API Documentation
${project.version}.${svn_revision}</header>
<source>1.8</source>
<use>true</use>
<version>true</version>
<windowtitle>${project.name} API Documentation
${project.version}.${svn_revision}</windowtitle>
<additionalparam>-Xdoclint:none</additionalparam>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
<phase>deploy</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
Running this gets me the correct javadoc-generation in the targeted folder. When I pushed it to the svn repository and my mate downloaded, it was not working for him.
There is no Error and no warning, it just does not generate the javadoc.
Additional info:
We are not using any local settings.xml.
The output of mvn site -X (debug mode) does not make any difference regarding the javadoc-plugin.
He already reinstalled jdk and re-set his $JAVA_HOME.
Same Maven version
What could be the problem?
Thank you in advance
Run mvn -v to make sure you're using the same Maven and Java versions. The command will print the paths to the Java runtime, make sure they are same and correct.
If that checks out, run mvn help:effective-pom to see what Maven will execute. Redirect the output on both machines to a file and compare them.
Next, try to invoke the plugin directly from the command line. If that works, attaching to the life cycle doesn't work for some reason. If it doesn't work, check for error messages and use -X to check the plugin configuration.
If everything else fails, delete your local Maven repository (or at least the involved plugins).

How can I run a Maven webapp in Eclipse when I need resource filtering for properties files?

I need to get some updates on this issue, I found this thread back in 2009 here, but the answer was to use maven 2, I'm not sure if Q4E works with maven 3 or not. I need to have some properties files filtered during the mvn package phase for the resulting war to be functional, the resource filtering is working fine with CLI mvn install. But when I do "Run on server/debug on server", the filtering is not working any more.
The aforementioned thread author ended up using q4e, claiming q4e gets the resource filtering right. I have q4e installed as well along with m2e, but still doesn't work, so I don't know if q4e is not working with maven 3, or I'm doing something wrong.
Thanks,
David
updated to the latest m2e-wtp plugin 0.15 (resource filtering bug fix since 0.12), it works fine now.
I'm not sure if this matches your problem, but I wanted to populate my web.xml file with properties from the pom during build and I put a groovy script in the pom to do it. It worked a treat and might work for you too. It definately works in both eclipse and on the command line. Here is my pom fragment:
<plugin>
<!-- Groovy script to set the description and version in the web.xml display name -->
<groupId>org.codehaus.groovy.maven</groupId>
<artifactId>gmaven-plugin</artifactId>
<version>1.0</version>
<executions>
<execution>
<id>groovy-magic</id>
<phase>prepare-package</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<source>
def file = new File("src/main/webapp/WEB-INF/web.xml");
def fileText = file.text;
def match = "<display-name>[^<]*</display-name>";
def replace = "<display-name>"+project.description+" "+project.version+"</display-name>";
fileText = fileText.replaceAll(match, replace);
file.write(fileText);
println "Updated web.xml"
</source>
</configuration>
</execution>
</executions>
</plugin>

AspectJ Maven Plugin <weaveDependency>

I am trying to use aspectj maven plugin in our project that has multiple modules. Following the instructions given in this link http://mojo.codehaus.org/aspectj-maven-plugin/weaveJars.html
I am using #Aspectj annotation. My aspect is in a separate maven module called
artifactId - consumer
And the class whose method i want to intercept or advice is in
artifactId - producer
I have added the following configuration in the pom file of the consumer module:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.4</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<showWeaveInfo>true</showWeaveInfo>
<weaveDependencies>
<weaveDependency>
<groupId>com.home.demo</groupId>
<artifactId>producer</artifactId>
</weaveDependency>
</weaveDependencies>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
Also added "producer" as a dependency in the same pom file.
When i am doing mvn clean install for the consumer module the following information comes in the console.
[INFO] [aspectj:compile {execution: default}]
[INFO] Join point 'method-execution(void com.home.demo.producer.messaging.MomServiceEndpointListener.handle(com.home.messaging.service.MessageContext, com.home.messaging.service.MessageContext))' in
Type 'com.home.demo.producer.messaging.MomServiceEndpointListener' (MomServiceEndpointListener.java:21) advised by before advice from 'com.home.demo.ods.app.OdsConsumer' (OdsConsumer.java:38)
But while executing the application, it's not working. The aspect is not getting invoked.
I am not able to understand whether i am missing something.
Also i am having confusion whether the plugin configuration shown above should be in which module consumer(where my aspects are) or producer.
The problem is that weaveDependencies act like sources only.
Your consumer module takes original "sources" from weaveDependencies (producer), weaves them with aspects and put weaved classes into consumer(!!!) target/classes.
Therefore, producer artifact never knows about aspects and you use it unchanged.
You have to re-build a producer jar using classes from consumer/target/classes.
I don't think it's convenient, so i left my attempts to use this plugin in this way.
Also, several weaveDependencies will be merged into one scrap-heap of classes.
You better try Aspects from your external jar dependency and plugin config that is built into producer.

Maven assembly plugin does not overwrite files during compile phase

I have defined maven assembly plugin and have set pom to execute the plugin(assembly.xml) in "compile" phase. assembly.xml - it gets the jars/files using "dependencySet" and I replace few files with my local set using "fileSet".
With Maven assembly plugin 2.2 beta 2 it would replace the files.
With version 2.2 or 2.2.1 of assembly plugin,
a) it says "already added, skipping" and does not overwrite.
b) if I modify the phase to "generate-resources" instead of "compile" in the pom, it shows the 'already added, skipping" message and anyways replaces/overwrites the files.
Would like to know, what has changed between versions and why the phase change would make it work. Also it would be helpful if someone can explain what exactly happens in "compile" phase (that it doesn't overwrite).
Is there a workaround for my issue?
Thanks in advance for the help!
Included the snippet:
`<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<id>create-install-image-layout</id>
<phase>compile</phase>
<goals>
<goal>directory-single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>src/main/assembly/assembly.xml</descriptor>
</descriptors>
<ignoreDirFormatExtensions>false</ignoreDirFormatExtensions>
</configuration>
</execution>
</executions>
</plugin>`
The goal directory-single is marked as deprecated. Furthermore the newest release of maven-assembly-plugin is 2.2.2 instead of 2.2. Furthermore to create an archive for any purpose the correct phase would be the package phase instead of the compiler phase where the compilation of the sources will be done.
What goal are you executing? Are you executing clean first? It may be skipping the compile phase because the code is already compiled.