Opentaps在Windows 64位系统下编译AOP模块出错的解决方法
在Opentaps 1.4版本我将AOP由原来的AspectJ替换为现在Aspectwerkz。结果我自己就首先在64bit的windows系统下遇到ant编译出错,现在把解决方法列在这里
将opentaps/opentaps-common/build-aspects.xml中的weave任务内容替换为以下内容(其实就是把原来的ant的替换jar内容任务分成两部来执行):
以上方法已经在opentaps wiki [ http://www.opentaps.org/docs/index.php/General_Installation_of_Opentaps#Build_Aspect_class_Errors] 中加上过了。
将opentaps/opentaps-common/build-aspects.xml中的weave任务内容替换为以下内容(其实就是把原来的ant的替换jar内容任务分成两部来执行):
<!--
==================================================================
-->
<!-- Weave advice into target jars -->
<!-- ================================================================== -->
< target name ="weave" depends ="detect-dependencies" if ="processRequired" >
< echo message ="[build] =========== Start Building Aspect (Weave) =============" />
< java classname ="org.codehaus.aspectwerkz.compiler.AspectWerkzC" fork ="true" >
< jvmarg value ="-Daspectwerkz.definition.file=${aopConfig}" />
< jvmarg value ="-Daspectwerkz.transform.filter=no" />
<!-- <jvmarg value="-Daspectwerkz.transform.verbose=true"/> -->
<!-- <jvmarg value="-Daspectwerkz.transform.details=true"/> -->
< arg value ="-verify" />
< classpath refid ="local.class.path" />
< classpath >
< pathelement path ="${build.dir}/classes/common" />
</ classpath >
<!-- below is the jars to post-process -->
< arg value ="${ofbiz.dir}/framework/entity/build/lib/ofbiz-entity.jar" />
</ java >
< java classname ="org.codehaus.aspectwerkz.compiler.AspectWerkzC" fork ="true" >
< jvmarg value ="-Daspectwerkz.definition.file=${aopConfig}" />
< jvmarg value ="-Daspectwerkz.transform.filter=no" />
<!-- <jvmarg value="-Daspectwerkz.transform.verbose=true"/> -->
<!-- <jvmarg value="-Daspectwerkz.transform.details=true"/> -->
< arg value ="-verify" />
< classpath refid ="local.class.path" />
< classpath >
< pathelement path ="${build.dir}/classes/common" />
</ classpath >
<!-- below is the jars to post-process, if these jar not effect each other you can put them in same pos, else please seperate them into another task -->
< arg value ="${ofbiz.dir}/framework/common/build/lib/ofbiz-common.jar" />
</ java >
< java classname ="org.codehaus.aspectwerkz.compiler.AspectWerkzC" fork ="true" >
< jvmarg value ="-Daspectwerkz.definition.file=${aopConfig}" />
< jvmarg value ="-Daspectwerkz.transform.filter=no" />
<!-- <jvmarg value="-Daspectwerkz.transform.verbose=true"/> -->
<!-- <jvmarg value="-Daspectwerkz.transform.details=true"/> -->
< arg value ="-verify" />
< classpath refid ="local.class.path" />
< classpath >
< pathelement path ="${build.dir}/classes/common" />
</ classpath >
<!-- below is the jars to post-process -->
< arg value ="${ofbiz.dir}/applications/order/build/lib/ofbiz-order.jar" />
</ java >
< jar jarfile ="${lib.dir}/${name}.jar" update ="true" basedir ="${build.dir}/classes/common" includes ="org/opentaps/aspect/secas/**" />
<!-- put aop.xml into target jar META-INF dir -->
< mkdir dir ="${build.dir}/classes/META-INF" />
< copy file ="${aopConfig}" tofile ="${build.dir}/classes/META-INF/aop.xml" overwrite ="true" />
<!-- create new jar with aop.xml, then copy it to orign location, using these for avoid unable rename error on windows 64bit system -->
< zip destfile ="${lib.dir}/ofbiz-entity.jar" >
< zipfileset src ="${ofbiz.dir}/framework/entity/build/lib/ofbiz-entity.jar" />
< fileset dir ="${build.dir}/classes/" >
< include name ="META-INF/aop.xml" />
</ fileset >
</ zip >
< delete file ="${ofbiz.dir}/framework/entity/build/lib/ofbiz-entity.jar" failonerror ="false" />
< move file ="${lib.dir}/ofbiz-entity.jar" tofile ="${ofbiz.dir}/framework/entity/build/lib/ofbiz-entity.jar" />
< zip destfile ="${lib.dir}/ofbiz-common.jar" >
< zipfileset src ="${ofbiz.dir}/framework/common/build/lib/ofbiz-common.jar" />
< fileset dir ="${build.dir}/classes/" >
< include name ="META-INF/aop.xml" />
</ fileset >
</ zip >
< delete file ="${ofbiz.dir}/framework/common/build/lib/ofbiz-common.jar" failonerror ="false" />
< move file ="${lib.dir}/ofbiz-common.jar" tofile ="${ofbiz.dir}/framework/common/build/lib/ofbiz-common.jar" />
< zip destfile ="${lib.dir}/ofbiz-order.jar" >
< zipfileset src ="${ofbiz.dir}/applications/order/build/lib/ofbiz-order.jar" />
< fileset dir ="${build.dir}/classes/" >
< include name ="META-INF/aop.xml" />
</ fileset >
</ zip >
< delete file ="${ofbiz.dir}/applications/order/build/lib/ofbiz-order.jar" failonerror ="false" />
< move file ="${lib.dir}/ofbiz-order.jar" tofile ="${ofbiz.dir}/applications/order/build/lib/ofbiz-order.jar" />
< echo message ="[build] =========== Done Building Aspect (Weave) ==============" />
</ target >
<!-- Weave advice into target jars -->
<!-- ================================================================== -->
< target name ="weave" depends ="detect-dependencies" if ="processRequired" >
< echo message ="[build] =========== Start Building Aspect (Weave) =============" />
< java classname ="org.codehaus.aspectwerkz.compiler.AspectWerkzC" fork ="true" >
< jvmarg value ="-Daspectwerkz.definition.file=${aopConfig}" />
< jvmarg value ="-Daspectwerkz.transform.filter=no" />
<!-- <jvmarg value="-Daspectwerkz.transform.verbose=true"/> -->
<!-- <jvmarg value="-Daspectwerkz.transform.details=true"/> -->
< arg value ="-verify" />
< classpath refid ="local.class.path" />
< classpath >
< pathelement path ="${build.dir}/classes/common" />
</ classpath >
<!-- below is the jars to post-process -->
< arg value ="${ofbiz.dir}/framework/entity/build/lib/ofbiz-entity.jar" />
</ java >
< java classname ="org.codehaus.aspectwerkz.compiler.AspectWerkzC" fork ="true" >
< jvmarg value ="-Daspectwerkz.definition.file=${aopConfig}" />
< jvmarg value ="-Daspectwerkz.transform.filter=no" />
<!-- <jvmarg value="-Daspectwerkz.transform.verbose=true"/> -->
<!-- <jvmarg value="-Daspectwerkz.transform.details=true"/> -->
< arg value ="-verify" />
< classpath refid ="local.class.path" />
< classpath >
< pathelement path ="${build.dir}/classes/common" />
</ classpath >
<!-- below is the jars to post-process, if these jar not effect each other you can put them in same pos, else please seperate them into another task -->
< arg value ="${ofbiz.dir}/framework/common/build/lib/ofbiz-common.jar" />
</ java >
< java classname ="org.codehaus.aspectwerkz.compiler.AspectWerkzC" fork ="true" >
< jvmarg value ="-Daspectwerkz.definition.file=${aopConfig}" />
< jvmarg value ="-Daspectwerkz.transform.filter=no" />
<!-- <jvmarg value="-Daspectwerkz.transform.verbose=true"/> -->
<!-- <jvmarg value="-Daspectwerkz.transform.details=true"/> -->
< arg value ="-verify" />
< classpath refid ="local.class.path" />
< classpath >
< pathelement path ="${build.dir}/classes/common" />
</ classpath >
<!-- below is the jars to post-process -->
< arg value ="${ofbiz.dir}/applications/order/build/lib/ofbiz-order.jar" />
</ java >
< jar jarfile ="${lib.dir}/${name}.jar" update ="true" basedir ="${build.dir}/classes/common" includes ="org/opentaps/aspect/secas/**" />
<!-- put aop.xml into target jar META-INF dir -->
< mkdir dir ="${build.dir}/classes/META-INF" />
< copy file ="${aopConfig}" tofile ="${build.dir}/classes/META-INF/aop.xml" overwrite ="true" />
<!-- create new jar with aop.xml, then copy it to orign location, using these for avoid unable rename error on windows 64bit system -->
< zip destfile ="${lib.dir}/ofbiz-entity.jar" >
< zipfileset src ="${ofbiz.dir}/framework/entity/build/lib/ofbiz-entity.jar" />
< fileset dir ="${build.dir}/classes/" >
< include name ="META-INF/aop.xml" />
</ fileset >
</ zip >
< delete file ="${ofbiz.dir}/framework/entity/build/lib/ofbiz-entity.jar" failonerror ="false" />
< move file ="${lib.dir}/ofbiz-entity.jar" tofile ="${ofbiz.dir}/framework/entity/build/lib/ofbiz-entity.jar" />
< zip destfile ="${lib.dir}/ofbiz-common.jar" >
< zipfileset src ="${ofbiz.dir}/framework/common/build/lib/ofbiz-common.jar" />
< fileset dir ="${build.dir}/classes/" >
< include name ="META-INF/aop.xml" />
</ fileset >
</ zip >
< delete file ="${ofbiz.dir}/framework/common/build/lib/ofbiz-common.jar" failonerror ="false" />
< move file ="${lib.dir}/ofbiz-common.jar" tofile ="${ofbiz.dir}/framework/common/build/lib/ofbiz-common.jar" />
< zip destfile ="${lib.dir}/ofbiz-order.jar" >
< zipfileset src ="${ofbiz.dir}/applications/order/build/lib/ofbiz-order.jar" />
< fileset dir ="${build.dir}/classes/" >
< include name ="META-INF/aop.xml" />
</ fileset >
</ zip >
< delete file ="${ofbiz.dir}/applications/order/build/lib/ofbiz-order.jar" failonerror ="false" />
< move file ="${lib.dir}/ofbiz-order.jar" tofile ="${ofbiz.dir}/applications/order/build/lib/ofbiz-order.jar" />
< echo message ="[build] =========== Done Building Aspect (Weave) ==============" />
</ target >
以上方法已经在opentaps wiki [ http://www.opentaps.org/docs/index.php/General_Installation_of_Opentaps#Build_Aspect_class_Errors] 中加上过了。