ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark McKay <m...@kitfox.com>
Subject Re: Can't compile with <apt>
Date Fri, 01 Sep 2006 11:43:39 GMT
Steve Loughran wrote:
> Mark McKay wrote:
>> I seem to be unable to compile my program using the new <apt> task.  
>> At first, I simply changed an existing javac tag to apt and tried to 
>> compile, but received an error.  I tried playing with the options, 
>> but am still receiving similar errors.  I would eventually like to 
>> have apt locate some custom processors I've written and process 
>> annotations, but for now I'll be happy to simply get <apt> to 
>> duplicate <javac>.
>>
>> I'm using the below code to attempt to compile my code.  The below 
>> works find if I use javac instead of apt.
>>
>>        <apt debug="true" destdir="${classes.dir}">
>>            <compilerarg value="-Xlint"/>
>>            <src>
>>                <path refid="path.sourcepath"/>
>>            </src>
>>            <classpath>
>>                <path refid="path.classpath"/>
>>            </classpath>
>>        </apt>
>>
>>
>> This is the error message generated:
>>
>>
>> compile:
>> com\kitfox\myClass1.class is up to date.
>> com\kitfox\myClass2.class is up to date.
>> [snip]
>> Compiling 3 source files to 
>> C:\dev\svn.kitfox.com\kitfox-swing\build\classes
>> Using external apt compiler
>> Compilation arguments:
>> '-d'
>> 'C:\dev\svn.kitfox.com\kitfox-swing\build\classes'
>> '-classpath'
>> 'C:\dev\svn.kitfox.com\kitfox-swing\build\classes;C:\dev\svn.kitfox.com\kitfox-utilities\build\jar\kitfox-utilities.jar;C:\dev\svn.kitfox.com\kitfox-math\build\jar\kitfox-math.jar;C:\dev\cvs.dev.java.net\svgsalamander\build\jar\svgSalamander.jar;C:\Program

>> Files\netbeans-5.5beta2\platform6\modules\org-jdesktop-layout.jar;C:\dev\svn.kitfox.com\kitfox-swing\lib\library\vecmath.jar;C:\dev\svn.kitfox.com\kitfox-swing\src\main\res;C:\java\apache-ant-1.7.0Beta1\lib\ant-antlr.jar;C:\java\apache-ant-1.7.0Beta1\lib\ant-apache-bcel.jar;C:\java\apache-ant-1.7.0Beta1\lib\ant-apache-bsf.jar;C:\java\apache-ant-1.7.0Beta1\lib\ant-apache-log4j.jar;C:\java\apache-ant-1.7.0Beta1\lib\ant-apache-oro.jar;C:\java\apache-ant-1.7.0Beta1\lib\ant-apache-regexp.jar;C:\java\apache-ant-1.7.0Beta1\lib\ant-apache-resolver.jar;C:\java\apache-ant-1.7.0Beta1\lib\ant-commons-logging.jar;C:\java\apache-ant-1.7.0Beta1\lib\ant-commons-net.jar;C:\java\apache-ant-1.7.0Beta1\lib\ant-jai.jar;C:\java\apache-ant-1.7.0Beta1\lib\ant-javamail.jar;C:\java\apache-ant-1.7.0Beta1\lib\ant-jdepend.jar;C:\java\apache-ant-1.7.0Beta1\lib\ant-jmf.jar;C:\java\apache-ant-1.7.0Beta1\lib\ant-jsch.jar;C:\java\apache-ant-1.7.0Beta1\lib\ant-junit.jar;C:\java\apache-ant-1.7.0Beta1\lib\ant

>>
> -launcher.jar;C:\java\apache-ant-1.7.0Beta1\lib\ant-netrexx.jar;C:\java\apache-ant-1.7.0Beta1\lib\ant-nodeps.jar;C:\java\apache-ant-1.7.0Beta1\lib\ant-starteam.jar;C:\java\apache-ant-1.7.0Beta1\lib\ant-stylebook.jar;C:\java\apache-ant-1.7.0Beta1\lib\ant-swing.jar;C:\java\apache-ant-1.7.0Beta1\lib\ant-trax.jar;C:\java\apache-ant-1.7.0Beta1\lib\ant-weblogic.jar;C:\java\apache-ant-1.7.0Beta1\lib\ant.jar;C:\java\apache-ant-1.7.0Beta1\lib\jsch-0.1.29.jar;C:\java\apache-ant-1.7.0Beta1\lib\xercesImpl.jar;C:\java\apache-ant-1.7.0Beta1\lib\xml-apis.jar;C:\java\bsf\bsf-2.3.0\lib\bsf.jar;C:\java\beanshell\bsh-2.0b4.jar;C:\Program

>
>> Files\netbeans-5.5beta2\ide7\modules\ext\jsch-0.1.24.jar;C:\Program 
>> Files\netbeans-5.5beta2\ide7\modules\ext\junit-3.8.1.jar;C:\Program 
>> Files\netbeans-5.5beta2\platform6\lib\boot.jar;C:\Program 
>> Files\netbeans-5.5beta2\platform6\lib\org-openide-modules.jar;C:\Program 
>> Files\netbeans-5.5beta2\platform6\lib\org-openide-util.jar;C:\Program 
>> Files\Java\jdk1.6.0\lib\dt.jar;C:\Program 
>> Files\Java\jdk1.6.0\lib\tools.jar'
>> '-sourcepath'
>> 'C:\dev\svn.kitfox.com\kitfox-swing\src\main\java'
>> '-g'
>> '-Xlint'
>> The ' characters around the executable and arguments are
>> not part of the command.
>> Files to be compiled:
>>    
>> C:\dev\svn.kitfox.com\kitfox-swing\src\main\java\com\kitfox\awt\image\filter\package-info.java

>>
>>    
>> C:\dev\svn.kitfox.com\kitfox-swing\src\main\java\com\kitfox\swing\package-info.java

>>
>>    
>> C:\dev\svn.kitfox.com\kitfox-swing\src\main\java\com\kitfox\swing\parameterPanel\package-info.java

>>
>> Usage: apt <apt and javac options> <source files>
>> where apt options include:
>>  -classpath <path>          Specify where to find user class files 
>> and annotation processor factories
>>  -cp <path>                 Specify where to find user class files 
>> and annotation processor factories
>>  -d <path>                  Specify where to place processor and 
>> javac generated class files
>>  -s <path>                  Specify where to place processor 
>> generated source files
>>  -source <release>          Provide source compatibility with 
>> specified release
>>  -version                   Version information
>>  -help                      Print a synopsis of standard options; use 
>> javac -help for more options
>>  -X                         Print a synopsis of nonstandard options
>>  -J<flag>                   Pass <flag> directly to the runtime system
>>  -A[key[=value]]            Options to pass to annotation processors
>>  -nocompile                 Do not compile source files to class files
>>  -print                     Print out textual representation of 
>> specified types
>>  -factorypath <path>        Specify where to find annotation 
>> processor factories
>>  -factory <class>           Name of AnnotationProcessorFactory to 
>> use; bypasses default discovery process
>> See javac -help for information on javac options.
>>
>> BUILD SUCCESSFUL (total time: 4 seconds)
>
> This looks like a bug. Two bugs. The command line error is not being 
> detected as failure, and the command line is being set up wrong
>
> 1. What java version are you using?
>
> 2. Can you tease everything out into a self contained test (build 
> file+source files) that we could run under ant?
>
> 3. It could be the -g option. Try setting up the command by hand 
> without that and see if it works. Let us know the results
>
> -steve

Hmm.  Looks like it was my fault.  The annotation processor I wrote was 
making a call to Filer.createTextFile() with null being passed in as the 
second argument (which was throwing a NullPointerException ).  When I 
fixed this, I was able to compile.  For some reason, when I was creating 
the small test case, this NullPointerException was printed out, but this 
didn't happen when I was processing my large project.  Does apt print a 
stack trace whenever it encounters an exception?

Thanks,

Mark McKay


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message