0
我已经编写了一些Struts2 taglib并希望将它们打包成jar。 我没有使用maven,所以我曾经使用带有struts-annotations-1.0.5.jar的apt标签的Ant。 而我的任务看起来像下面使用Java6生成struts2 taglib使用ant的注释处理器
<target name="generate-taglib" >
<apt classpathref="tags.classpath" factorypathref="tags.classpath"
srcdir="StrutsTags" compile="false" destdir="dist/apt" fork="true"
preprocessdir="bin" verbose="false" source="1.5" encoding="utf-8"
factory="org.apache.struts.annotations.taglib.apt.TLDAnnotationProcessorFactory" includeantruntime="false">
<compilerarg value="-AtlibVersion=1.0" />
<compilerarg value="-AjspVersion=2.0" />
<compilerarg value="-AshortName=mb" />
<compilerarg value="-Auri=/struts-my-tags" />
<compilerarg value="-Adescription='My Struts Tags'" />
<compilerarg value="-AdisplayName='My Struts Tags'" />
<compilerarg value="-AoutTemplatesDir=${basedir}/dist/taglib-doc" />
<compilerarg value="-AoutFile=${basedir}/bin/META-INF/struts-my-tags.tld" />
</apt>
</target>
但是由于Java 6易已被删除或不支持我想使用注解处理器在Java编译器。但我无法找到任何直接的例子,我有以下
<target name="generate-taglib" depends="compile">
<javac destdir="bin"
debug="true"
failonerror="true"
compiler="javac1.6"
srcdir="StrutsTags" includeantruntime="false" encoding="utf-8" verbose="true">
<include name="**/*.java"/>
<classpath refid="tags.classpath"/>
<compilerarg line="-proc:only"/>
<compilerarg line="-processor org.apache.struts.annotations.taglib.apt.TagAnnotationProcessor" />
<compilerarg line="-s dist/apt" />
<compilerarg line="-source 6"/>
<compilerarg value="-AtlibVersion=1.0.1" />
<compilerarg value="-AjspVersion=2.0" />
<compilerarg value="-AshortName=mb" />
<compilerarg value="-Auri=/struts-my-tags" />
<compilerarg value="-Adescription='My Struts Tags'" />
<compilerarg value="-AdisplayName='My Struts Tags'" />
<compilerarg value="-AoutTemplatesDir=${basedir}/dist/taglib-doc" />
<compilerarg value="-AoutFile=${basedir}/bin/META-INF/struts-my-tags.tld" />
</javac>
</target>
上来当我运行这个任务成功完成,但没有什么是在struts-MY-tags.tld产生。
有人能告诉我什么是错的?
这可能是一个问题:-AtlibVersion = 1.0.1,这必须是一个有效的十进制值。尝试将其更改为-AtlibVersion = 1.1 – 2013-04-05 08:08:27