We have a project that we compile through Ant, we had some issues people wrote code that's only compilable by eclipse compiler, not through the regular javac, so we changed the compiler by passing in the ecj* jar file when calling ant on the commend-line.
We currently decide to use Project Lombok, it looks good, and it works great on local eclipse IDE's, when it comes to compile on server through a build script, it doesn't encounter in any exception, but at run-time he could not find the getter method etc.
The lomboc.jar file is in our lib folder we specify in build.xml.
Does any body have experience with this scenario?
Thanks
UPDATE
I found a link http://projectlombok.org/setup/ecj.html that explains how to use it with ecj, but i don't understand how i could use it, because we call ant and pass in the ecj jar file in the lib argument.
Finally i figured it out.
I have to use <exec executable="java"> to compile, instead of the javac tag.
Hare is my example:
<exec executable="${env.JAVA_HOME}/bin/java">
<arg value="-javaagent:${lombok_jar}=ECJ"/>
<arg value="-cp"/>
<arg pathref="compile.classpath"/>
<arg value="-jar"/>
<arg value="${ecj_jar}"/>
<arg value="-cp"/>
<arg pathref="compile.classpath"/>
<arg value="-d"/>
<arg value="${classes}"/>
<arg value="${src}"/>
</exec>
Related
With GWT 2.4 obfuscation is performed for RequestFactory interfaces.
Is there any way to disable this? Specifically I am looking to get at the names of actual RF method names in the client.
This is not possible.
If you run the "ValidationTool" as an annotation processor, you can get the generated source of the deobfuscator written to a file, where you'll find the mappings between obfuscated names and actual domain classes and methods/properties.
You can disable obfuscation in all module if add "-style PRETTY|DETAILED" in GWT compiler options
<java classname="com.google.gwt.dev.GWTCompiler" classpathref="gwt.classpath" fork="true" failonerror="true">
<jvmarg="-Xmx256M"/>
<arg value="-style" />
<arg value="PRETTY" />
<arg value="-out" />
<arg value="../html" />
<arg value="YourModule"/>
</java>
I use:
<java failonerror="true" classname="com.google.web.bindery.requestfactory.apt.ValidationTool">
<arg path="${path.to.ouput.jar}" />
<arg value="com.my.RequestFactory" />
<classpath>
<path refid="my_classpath" />
</classpath>
</java>
my_classpath has all requestfactory-client.jar, requestfactory-server.jar, requestfactory-apt.jar + my source & the jar produced from it in the path (that's confirmed with just printing it), but I still get:
[java] error: Unable to find RequestFactory built-in type. Is requestfactory-[client|server].jar on the classpath?
What could be wrong here?
For me, this works only, if I specify <javac fork="true" ...
From the official ant documentation on the java task:
If odd things go wrong when you run this task, set fork="true" to use a new JVM.
Without any deep investigation, I would say it's most likely a classloader problem.
I am using following command in NAnt build file
<msbuild project="${appsdest}\${targetname}\${targetname}.sln"/>
appsdest and targetname are variable contain application project path and targetname is the variable contain project name to be rebuild.
but when using this command it build the solution but the time stamp of dlls are not updated.
I need to rebuild the solution and the latest dlls need to be place in debug folder.
can anyone tell me how to rebuild the solution using the msbuild command as written above?
Thanks
I don't use the MSBUILD tasks in NAnt, I just call the msbuild executable directly and it has worked well for me.
<target name="build">
<exec program="${MSBuildPath}">
<arg line='"${SolutionFile}"' />
<arg line="/property:Configuration=${SolutionConfiguration}" />
<arg value="/target:Rebuild" />
<arg value="/verbosity:normal" />
<arg value="/nologo" />
<arg line='/logger:"C:\Program Files\CruiseControl.NET\server\ThoughtWorks.CruiseControl.MsBuild.dll"'/>
</exec>
</target>
I write more about it here: http://enterpriseyness.com/2009/12/continuous-integration-with-cruise-control-net-nant
You need to use the 'Rebuild' target:
<msbuild project="${appsdest}\${targetname}\${targetname}.sln" target="Rebuild"/>
Could someone tell me what I need to do to enable Guava support in GWT.
I have downloaded Guava R07 and in there there are the following two files:
guava-r07.jar
guava-r07-gwt.jar
I have a few questions regarding this:
Where do these files go? I am guessing that the standard Jar is made available to my IDE for coding, and that both are made available to the GWT compiler for building the JavaScript?
Do I need to add all the .gwt.xml files from the -gwt.jar into my project's main gwt.xml file or only the portions I need?
There are other Jars on the trunk of the Guava&GWT project (ie not in the download, such as one for jsr305) which I think I may need, but I'm not sure.
Sorry, normally I don't have trouble with this kind of thing, but I can't quite work out what goes where.
FYI I'm using GWT 1.6 for the time being, but am hoping to move to 2 soon. If Guava isn't compatible with 1.6 that is not a problem.
Update
I have the following files in a folder called gwtlib:
guava-r07-gwt.jar
guava-r07.jar
jsr305-1.3.9.jar
And my Ant script does the following:
<path id="project.class.path">
<fileset dir="gwtlibs" includes="guava-r07.jar"/>
<fileset dir="gwtlibs" includes="guava-r07-gwt.jar"/>
<fileset dir="gwtlibs" includes="jsr305-1.3.9.jar"/>
<pathelement location="${gwt.sdk}/gwt-user.jar"/>
<fileset dir="${gwt.sdk}" includes="gwt-dev*.jar"/>
</path>
<target name="gwtc">
<java failonerror="true" fork="true" classname="com.google.gwt.dev.Compiler">
<classpath>
<pathelement location="app"/>
<path refid="project.class.path"/>
</classpath>
<jvmarg value="-Xmx256M"/>
<arg value="-localWorkers"/>
<arg value="2"/>
<arg value="-war"/>
<arg value="gwt-public"/>
<arg value="Main"/>
</java>
</target>
Running the above command, I get the following errors:
Errors in 'jar:file:///project/gwtlibs/guava-r07-gwt.jar!/com/google/common/collect/Constraints.java'
Line 254: The method subList(int, int) is undefined for the type List
Without the jsr jar on the classpath, I get the following errors:
The import javax.annotation cannot be resolved
Nullable cannot be resolved to a type
Thanks
Rich
Add these jars to your classpath. If you're using IDE, add them to your Build Path by right-clicking "Referenced Libraries" in your Package Exporer, select "Configure Build Path" and add them as external JARs.
You only need to inherit the modules you plan on using in your .gwt.xml file. For example, if you only use the common.collect package, just add <inherits name="com.google.common.collect.Collect" />
You probably don't need jsr305.jar, but if you do, just add it the same way as you added the other jars.
Guava should work just fine with GWT 1.6, if it doesn't then it's probably a bug.
Guava isn't compatible with GWT 1.6. List.subList, in particular, is added to GWT in GWT 2. The earliest version that we fully supported is GWT 2.0.4
I currently have this in my Ant build script:
<exec dir="${basedir}" executable="perl">
<arg line="${basedir}/version.pl -major"/>
</exec>
However, when that runs, I get this error message:
[exec] Could not open -major
[exec] Result: 2
To me, that says that what I have is trying to run a file called -major, which doesn't exist. The file is version.pl which takes an argument of -major.
How can I alter this to run version.pl with the argument -major?
Note that I am running the ant script on a Solaris machine, however cross-platform or solutions for other OSes are welcome for posterity.
I made a quick little Perl script that didn't do a whole lot and ran it just fine passing command line arguments to it using Ant 1.5 on a Solaris box.
<project name="perly" basedir="." default="run">
<target name="run">
<exec executable="perl" dir="${basedir}">
<arg value="version.pl"/>
<arg value="-major"/>
</exec>
</target>
</project>
$ ant run
What I can't quite understand is how you are getting "Could not open -major". Is this a custom die message or something? Is there supposed to be a filename passed instead of major?
You can try this:
<exec executable="perl" dir="${basedir}">
<arg value="version.pl"/>
<arg value="-major"/>
</exec>
On windows that is
Try this if it works:
<exec dir="${basedir}" executable="./test.pl">
<arg line="-major"/>
</exec>
From the ant exec doc:
dir: the directory in which the command should be executed.
So i guess it does a cd to the $dir and exec the $executable (shebang set)