How to write an Ant tag "JWSC to Gradle?







Ant task usage is described in the manual - https://docs.gradle.org/current/userguide/ant.html.

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 {
  antJwsc
  jwsc
}

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 : 'weblogic.wsee.tools.anttasks.JwscTask',
    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
  )

}

HTH

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 weblogic.wsee.tools.anttask.JwscTask 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/Telescope.java,
		type: 'JAXWS'
		descriptor file: 'WebContent/WEB-INF/web.xml',
		descriptor file: 'WebContent/WEB-INF/weblogic.xml'
		}
	}
ant.taskdef (
name : 'jwsc',
classname : 'weblogic.wsee.tools.anttasks.JwscTask',
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?

       <jwsc  
    	srcdir="src"      
    	destdir="dist"
    	debug="true"
    	classpathref="classpath">
    	<module name="${warname}">
    		<jws file="com/company/telescope/Telescope.java" type="JAXWS" />
    		<descriptor file="WebContent/WEB-INF/web.xml" />
    		<descriptor file="WebContent/WEB-INF/weblogic.xml" />
    	</module>
     </jwsc>

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',