0
votes

I'm attempting to use ant to deploy an ear to a weblogic server.

I started with the following :

<target name="deploy">
     <taskdef name="wldeploy" classname="weblogic.ant.taskdefs.management.WLDeploy">
     <wldeploy action="deploy" name="projName" source="proj.ear" user="user" password="pass" adminurl="localhost:8050" targets="mytarget"/>
</target>

However, this gave me the the following error :

taskdef class weblogic.ant.taskdefs.management.WLDeploy cannot be found using the classloader AntClassLoader[]

To solve this, I modified my taskdef to include the path to the weblogic jar. However, now I'm receiving this error :

[wldeploy] weblogic.Deployer -debug -verbose -noexit -name TPD -source C:\Program Files (x86)\Jenkins\jobs\PROJ\workspace\target\dist\proj.ear -targets mytarget -adminurl localhost:8050 -user user -password pass -deploy

[wldeploy] C:\Program Files (x86)\Jenkins\jobs\PROJ\workspace\build.xml:574: java.io.IOException: Cannot run program "D:\jdk1.7\jre\bin\java.exe": CreateProcess error=206, The filename or extension is too long

(The above is generated by Jenkins hosted on a Windows box).

I have a feeling this is being caused by the weblogic jar creating a classpath that's too large for Windows command prompt but my inexperience with Ant is giving me doubts. I've looked into using manifestclasspath, but again inexperience is preventing me from effectively implementing it.

What would be a good workaround for this?

1

1 Answers

0
votes

The DOS command line is very limiting in this regard. A workaround is to create a "pathing jar". This is a jar containing only aManifest.mf file, whose Class-Pathspecifies the disk paths of your long list of jars, etc. Now just add this pathing jar to your command line classpath. This is usually more convenient than packaging the actual resources together.

As I recall, the disk paths can be relative to the pathing jar itself. So the Manifest.mfmight look something like this:

Class-Path: this.jar that.jar ../lib/other.jar

If your pathing jar contains mainly foundational resources, then it won't change too frequently, but you will probably still want to generate it somewhere in your build. For example:

<jar destfile="pathing.jar"> <manifest> <attribute name="Class-Path" value="this.jar that.jar ../lib/other.jar"/> </manifest> </jar>