when maven via antrun executes java code dreaded error=206, filename or extension long
<java classname="com.me.api" failonerror="true" fork="true" maxmemory="128m" output="${wsdlfile}.out"> <arg value="${classname}" /> <arg value="${name}" /> <arg value="${wsdlfile}" /> <classpath> <path refid="maven.test.classpath" /> </classpath>
extending answer provided @user4386022: can define (starting ant 1.8) macro can if have same problem in different places in build process (and cannot copy-paste same snippet everywhere because ant not allow re-defining properties, error saying "manifest.classpath" defined.)
<macrodef name="create-classpath-jar" description="create classpath jar, avoid getting error createprocess error=206, filename or extension long"> <attribute name="classpathjar"/> <attribute name="classpathref"/> <sequential> <!-- turn classpath property formatted inclusion in manifest.mf file --> <local name="manifest.classpath.property"/> <manifestclasspath property="manifest.classpath.property" jarfile="@{classpathjar}"> <classpath refid="@{classpathref}" /> </manifestclasspath> <!-- create jar --> <jar destfile="@{classpathjar}"> <manifest> <attribute name="class-path" value="${manifest.classpath.property}"/> </manifest> </jar> </sequential> </macrodef> to use macro in targets or tasks, use this:
<path id="myclasspath"> ......... </path> <create-classpath-jar classpathjar="classpath-compile.jar" classpathref="myclasspath" />
Comments
Post a Comment