How to write an Ant tag "JWSC to Gradle?

Ant task usage is described in the manual -

Now having said that I think what you are going to need is the following

// Create a configuration so that we can isolate usage  form other dependencies.
configurations {

dependencies {
  // I dont't know what the maven coordinates are for the Weblogic 
  // Jar that contains the Ant task definitions, but you need to supply
  // that here
  antJwsc 'a:b:1.2.3'

  // Add dependencies you need when runnign jwsc
  jwsc 'foo:bar:1.2.3'
  jwsc 'moo:car:4.5.6'

// SImplistic task to show necessary steps
task jwsc << {

  // Load the task definition
  ant.taskdef (
    name : 'jwsc',
    classname : '',
    classpath : configurations.antJwsc.asPath

 // Now run the task. Due to Gradle's easy dpeency handling it is simple to use classpath
// rather than classpathref.
  ant.jwsc (
    srcdir : 'src',
    destdir : 'dist',
    debug : 'true',
    classpath : configurations.jwsc.asPath



1 Like

for classpath: why are you using configurations.antJwsc.asPath?

in my earlier script I have a script

So I thought when jwsc was calling the classpath refid = "classpath"
I assume it was trying to reference this class path.

Also, thank you so much for the example.

Error update:
taskdef class cannot be found using the classloader AntClassLoader[]

Here is my attempt to rewrite the Ant file

ant.jwsc (
srcdir : 'src',
destdir : 'dist',
debug : 'true',
classpath : configurations.jwsc.asPath) {
module (name : 'warname') {
		jws file: 'com/comcast/telescope/,
		type: 'JAXWS'
		descriptor file: 'WebContent/WEB-INF/web.xml',
		descriptor file: 'WebContent/WEB-INF/weblogic.xml'
ant.taskdef (
name : 'jwsc',
classname : '',
classpath : configurations.antJwsc.asPath) 

was written in a earlier target. So I did not rewrite it again in this target.

The reason why I kept it as two distinct configurations was to keep the classpath to load the Ant task separate from that which is passed to it as runtime. You could have chosen to have everything within the same configuration if it was needed.

You need to make sure you have the correct JAR on the classpath (or per my example supplied via Maven coordinates to the configuration).

1 Like

How would I correctly write the module tag under jwsc?

How would you write it in Ant XML?

    	<module name="${warname}">
    		<jws file="com/company/telescope/" type="JAXWS" />
    		<descriptor file="WebContent/WEB-INF/web.xml" />
    		<descriptor file="WebContent/WEB-INF/weblogic.xml" />

Then what you have done should work. Of not, paste the error here or as a gist.

1 Like

I get an error expecting ‘}’ found ‘:’

descriptor file: ‘WebContent/WEB-INF/web.xml’

Remove the extraneous comma after descriptor file: 'WebContent/WEB-INF/web.xml',