org.codehaus.mojo.weblogic.JwscMojo Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of weblogic-maven-plugin Show documentation
Show all versions of weblogic-maven-plugin Show documentation
This plugin will support various tasks within the Weblogic 8.1,
9.x, 10.x and 12.x environment. This version starts to support weblogic 10 and
11. The mojo supports such tasks as deploy,
undeploy,clientgen,servicegen, and appc are supported as well as
many others. The plugin uses exposed API's that are subject to
change but have been tested in 8.1 SP 4-6 and 9.0 - 9.2 MP3, 10.x.
There are two versions of the plugin to support the two
environments based on differences in the JDK. The 9.x version is
currently being refactored to support the standard JSR supported
deployment interface. The code used in the plugin has been
contributed to the Cargo project however to date has not be
integrated into the codebase. Please feel free to suggest
improvements or help support this plugin effort.
The newest version!
package org.codehaus.mojo.weblogic;
/*
* Copyright 2008 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.PatternSet;
import org.codehaus.mojo.weblogic.util.WeblogicMojoUtilities;
import weblogic.wsee.tools.anttasks.JwsFileSet;
import weblogic.wsee.tools.anttasks.JwsModule.Descriptor;
import weblogic.wsee.tools.anttasks.JwscTask;
import weblogic.wsee.tools.anttasks.MultipleJwsModule;
import java.io.File;
import java.util.Iterator;
/**
* Runs the JWSC compiler task for web service enabled code.
*
* @author Jon Osborn
* @version $Id: JwscMojo.java 17528 2012-09-17 01:53:18Z jonnio $
* @description This mojo will run the JSWC ant task
* @goal jwsc
* @requiresDependencyResolution compile
* @since weblogic-maven-plugin-2.9.1-SNAPSHOT
*/
public class JwscMojo
extends AbstractWeblogicMojo
{
/**
* The directory to output the generated code to.
*
* @parameter default-value="${project.build.directory}"
*/
private String outputDir;
/**
* The directory to find the jwsc enabled files.
*
* @parameter default-value="${basedir}/src/main/java"
*/
private String inputDir;
/**
* The name of the war to use when evaluating the ear file.
*
* @required
* @parameter default-value="${project.artifactId}-${project.version}"
*/
private String outputName;
/**
* The flag to set when desiring verbose output
*
* @parameter default-value="false"
*/
private boolean verbose;
/**
* The flag to set when debugging the process
*
* @parameter default-value="false"
*/
private boolean debug;
/**
* The flag to set when wanting exploded output. Defaults to true.
*
* @parameter default-value="true"
*/
private boolean explode;
/**
* The flag to set when requiring optimization. Defaults to true.
*
* @parameter default-value="true"
*/
private boolean optimize;
/**
* The deployed context of the web service.
*
* @parameter
* @required
*/
private String contextPath;
/**
* The web.xml descriptor to use if a new one should not be generated. The
* path should be fully qualified.
* If there is more than one descriptor, use a
* comma ',' separated list.
*
* @parameter
*/
private String descriptor;
/**
* The explicit includes list for the file set
*
* @parameter default-value="**\/*.java" expression="${weblogic.jwsc.includes}"
*/
private String sourceIncludes;
/**
* The explicit includes list for the file set
*
* @parameter expression="${weblogic.jwsc.excludes}"
*/
private String sourceExcludes;
/**
* The keep generated flag for the mojo
*
* @parameter default-value="false" expression="${weblogic.jwsc.keepGenerated}"
*/
private boolean keepGenerated;
/**
* The task type JAXRPC JAXWS
* @parameter default-value="JAXRPC" expression="${weblogic.jwsc.type}"
*/
private String jwscTaskType;
/**
* This method will run the jswc on the target files
*
* @throws MojoExecutionException Thrown if we fail to obtain the WSDL.
*/
public void execute()
throws MojoExecutionException
{
super.execute();
if ( getLog().isInfoEnabled() )
{
getLog().info( "Weblogic jwsc beginning for output " + this.outputName );
}
if ( getLog().isDebugEnabled() )
{
getLog().debug( "inputDir=" + this.inputDir + " contextPath=" + this.contextPath );
}
if ( this.contextPath == null )
{
getLog().warn( "Context path is null. It will be required if " + "more than one web service is present." );
}
try
{
Iterator iter = getDependencies().iterator();
while ( iter.hasNext() )
{
getLog().debug( iter.next().toString() );
}
final JwscTask task = new JwscTask();
addToolsJar( ClassLoader.getSystemClassLoader() );
final Project project = new Project();
project.addBuildListener( getDefaultLogger() );
project.setName( "jwsc" );
final Path path = new Path( project, WeblogicMojoUtilities
.getDependencies( this.getArtifacts(), this.getPluginArtifacts() ) );
if ( getLog().isDebugEnabled() )
{
getLog().debug( "Path=" + path.toString() );
}
task.setProject( project );
task.setTaskName( project.getName() );
task.setNowarn( false );
// Set the class path
task.setClasspath( path );
task.setDestdir( new File( this.outputDir ) );
task.setVerbose( this.verbose );
task.setOptimize( this.optimize );
task.setDebug( this.debug );
task.setSrcdir( new File( this.inputDir ) );
task.setKeepGenerated( this.keepGenerated );
if ( this.jwscTaskType != null && this.jwscTaskType.trim().length() > 0 ) {
task.setTaskType(this.jwscTaskType);
}
final MultipleJwsModule module = task.createModule();
final JwsFileSet jwsFileSet = module.createJwsFileSet();
jwsFileSet.setProject( project );
if ( this.jwscTaskType != null && this.jwscTaskType.trim().length() > 0 ) {
jwsFileSet.setType(this.jwscTaskType);
}
jwsFileSet.setSrcdir( new Path( project, this.inputDir ) );
PatternSet ps = null;
if ( this.sourceIncludes != null && this.sourceIncludes.length() > 0 ) {
if ( getLog().isDebugEnabled() ) {
getLog().debug("Using source includes " + this.sourceIncludes );
}
ps = jwsFileSet.createPatternSet();
ps.setIncludes( this.sourceIncludes );
}
if ( this.sourceExcludes != null && this.sourceExcludes.length() > 0 ) {
if ( getLog().isDebugEnabled() ) {
getLog().debug("Using source excludes " + this.sourceExcludes );
}
if ( ps == null ) {
ps = jwsFileSet.createPatternSet();
}
ps.setExcludes( this.sourceExcludes );
}
if ( getLog().isInfoEnabled() )
{
getLog().info( "fileset=" + jwsFileSet.getSrcdir().toString() );
}
if ( this.descriptor != null )
{
final String[] descriptors = this.descriptor.split( "," );
for ( int i=0;i© 2015 - 2025 Weber Informatics LLC | Privacy Policy