wilfuler
发贴: 2
积分: 0
|
于 2006-11-10 22:12
以下是含有script的compas-ant.xml的部分代码:
<target name="jar_iterator"> <script language="beanshell"> <![CDATA[ String path=project.getProperty( "compasEARlocation" ) + "/jars"; File jarsDir = new File( path ); String[] jars = jarsDir.list(); //all the subdirs containing the expanded jars for( i=0; i < jars.length; i++ ){ print( "Loading " + jars[i] + "..." );
// launches the manifest task that updates the original manifest with the compas-proxies.jar class-path entry manifestUpdater=project.createTask( "manifest" ); manifestUpdater.setFile( new File(path + "/" + jars[i] + "/META-INF/MANIFEST.MF") ); org.apache.tools.ant.taskdefs.ManifestTask.Mode mode = new org.apache.tools.ant.taskdefs.ManifestTask.Mode(); mode.setValue( "update" ); manifestUpdater.setMode( mode ); org.apache.tools.ant.taskdefs.Manifest.Attribute clsPath = new org.apache.tools.ant.taskdefs.Manifest.Attribute( "Class-Path", "compas-proxies.jar jboss_adaptor.jar" );//weblogic_adaptor.jar websphere_adaptor.jar manifestUpdater.addConfiguredAttribute( clsPath ); manifestUpdater.execute();
// creates the jar task and adds it to the repackJARs target jarer = project.createTask( "jar" ); repackJARs.addTask( jarer ); jarer.setDestFile( new File(path + "/" + jars[i] + ".jar") ); jarer.setBasedir( new File(path + "/" + jars[i]) ); jarer.setManifest( new File(path + "/" + jars[i] + "/META-INF/MANIFEST.MF") ); } ]]> </script> </target>
***************************************************************************************** 以下是ant执行后的错误信息:
[java] BUILD FAILED [java] file:E:/compas/scripts/compas-ant.xml:163: Could not create task or type of type: script.
[java] Ant could not find the task or a class this task relies upon.
[java] This is common and has a number of causes; the usual [java] solutions are to read the manual pages then download and [java] install needed JAR files, or fix the build file: [java] - You have misspelt 'script'. [java] Fix: check your spelling. [java] - The task needs an external JAR file to execute [java] and this is not found at the right place in the classpath. [java] Fix: check the documentation for dependencies. [java] Fix: declare the task. [java] - The task is an Ant optional task and optional.jar is absent [java] Fix: look for optional.jar in ANT_HOME/lib, download if needed [java] - The task was not built into optional.jar as dependent [java] libraries were not found at build time. [java] Fix: look in the JAR to verify, then rebuild with the needed [java] libraries, or download a release version from apache.org [java] - The build file was written for a later version of Ant [java] Fix: upgrade to at least the latest release version of Ant [java] - The task is not an Ant core or optional task [java] and needs to be declared using <taskdef>.
[java] Remember that for JAR files to be visible to Ant tasks implemented [java] in ANT_HOME/lib, the files must be in the same directory or on the [java] classpath
*****************************************************************************************
我分别使用ant 1.5.4 / 1.6.5 / 1.7.0Beta3进行尝试,均未成功。 错误信息中提到的optional.jar我已在lib中添加,错误依旧。
恳请大家帮忙解决,谢谢。
一个人成功的一生是终身大彻大悟,寻求自己的路,而不是做别人的梦,或者去实现他人的理想。
|