Package org.apache.cxf.maven_plugin
Class AbstractCodegenMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- org.apache.cxf.maven_plugin.AbstractCodegenMojo
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled
,org.apache.maven.plugin.Mojo
- Direct Known Subclasses:
WSDL2JavaMojo
,WSDL2JavaScriptMojo
public abstract class AbstractCodegenMojo extends org.apache.maven.plugin.AbstractMojo
-
-
Field Summary
Fields Modifier and Type Field Description protected org.sonatype.plexus.build.incremental.BuildContext
buildContext
protected String
classesDirectory
protected boolean
disableDependencyScan
By default all maven dependencies of type "wsdl" are added to the effective wsdlOptions.protected boolean
disableDirectoryScan
Disables the scanning of the wsdlRoot/testWsdlRoot directories.protected String[]
excludes
A list of wsdl files to exclude.protected String
fork
Allows running the JavaToWs in a separate process.protected String[]
includes
A list of wsdl files to include.protected File
markerDirectory
Directory in which the "DONE" markers are saved thatprotected List<org.apache.maven.artifact.Artifact>
pluginArtifacts
The plugin dependencies, needed for the fork modeprotected org.apache.maven.project.MavenProject
project
protected boolean
skipGarbageCollection
protected File
testWsdlRoot
protected boolean
useCompileClasspath
Use the compile classpath rather than the test classpath for execution useful if the test dependencies clash with those of wsdl2javaprotected File
wsdlRoot
-
Constructor Summary
Constructors Constructor Description AbstractCodegenMojo()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
addPluginArtifact(Set<URI> artifactsPath)
protected void
configureProxyServerSettings()
protected void
createMarkerFile(GenericWsdlOption wsdlOption, File doneFile, URI wsdlURI)
protected abstract List<GenericWsdlOption>
createWsdlOptionsFromScansAndExplicitWsdlOptions()
protected boolean
deleteDir(File f)
Recursively delete the given directoryprotected void
downloadRemoteWsdls(List<GenericWsdlOption> effectiveWsdlOptions)
void
execute()
protected void
forkOnce(Set<URI> classPath, List<GenericWsdlOption> effectiveWsdlOptions)
protected abstract org.apache.cxf.Bus
generate(GenericWsdlOption o, org.apache.cxf.Bus bus, Set<URI> cp)
protected List<String>
generateCommandLine(GenericWsdlOption wsdlOption)
protected File
getDoneFile(URI basedir, URI wsdlURI, String mojo)
protected abstract Class<?>
getForkClass()
protected abstract File
getGeneratedSourceRoot()
protected abstract File
getGeneratedTestRoot()
protected abstract String
getMarkerSuffix()
File
getWsdlFile(GenericWsdlOption option, File baseDir)
Try to find a file matching the wsdl path (either absolutely, relatively to the current dir or to the project base dir)URI
getWsdlURI(GenericWsdlOption option, URI baseURI)
protected void
runForked(Set<URI> classPath, String mainClassName, String[] args)
protected abstract boolean
shouldRun(GenericWsdlOption wsdlOption, File doneFile, URI wsdlURI)
Determine if code should be generated from the given wsdl
-
-
-
Field Detail
-
classesDirectory
@Parameter(property="project.build.outputDirectory", required=true) protected String classesDirectory
-
disableDependencyScan
@Parameter(property="cxf.disableDependencyScan", defaultValue="false") protected boolean disableDependencyScan
By default all maven dependencies of type "wsdl" are added to the effective wsdlOptions. Setting this parameter to true disables this functionality
-
disableDirectoryScan
@Parameter(property="cxf.disableDirectoryScan", defaultValue="false") protected boolean disableDirectoryScan
Disables the scanning of the wsdlRoot/testWsdlRoot directories. By default, we scan for *.wsdl (see include/exclude params as well) in the wsdlRoot directories and run the tool on all the wsdls we find. This disables that scan and requires an explicit wsdlOption to be set for each wsdl that needs to be processed.
-
fork
@Parameter(defaultValue="false") protected String fork
Allows running the JavaToWs in a separate process. Valid values are "false", "always", and "once" The value of "true" is equal to "once"
-
includes
@Parameter protected String[] includes
A list of wsdl files to include. Can contain ant-style wildcards and double wildcards. Defaults to *.wsdl
-
markerDirectory
@Parameter(property="cxf.markerDirectory", defaultValue="${project.build.directory}/cxf-codegen-plugin-markers") protected File markerDirectory
Directory in which the "DONE" markers are saved that
-
pluginArtifacts
@Parameter(required=true, readonly=true, property="plugin.artifacts") protected List<org.apache.maven.artifact.Artifact> pluginArtifacts
The plugin dependencies, needed for the fork mode
-
project
@Parameter(required=true, property="project") protected org.apache.maven.project.MavenProject project
-
useCompileClasspath
@Parameter(property="cxf.useCompileClasspath", defaultValue="false") protected boolean useCompileClasspath
Use the compile classpath rather than the test classpath for execution useful if the test dependencies clash with those of wsdl2java
-
excludes
@Parameter protected String[] excludes
A list of wsdl files to exclude. Can contain ant-style wildcards and double wildcards.
-
testWsdlRoot
@Parameter(property="cxf.testWsdlRoot", defaultValue="${basedir}/src/test/resources/wsdl") protected File testWsdlRoot
-
wsdlRoot
@Parameter(property="cxf.wsdlRoot", defaultValue="${basedir}/src/main/resources/wsdl") protected File wsdlRoot
-
skipGarbageCollection
@Parameter(property="cxf.skipGarbageCollection", defaultValue="false") protected boolean skipGarbageCollection
-
buildContext
@Component protected org.sonatype.plexus.build.incremental.BuildContext buildContext
-
-
Method Detail
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
generate
protected abstract org.apache.cxf.Bus generate(GenericWsdlOption o, org.apache.cxf.Bus bus, Set<URI> cp) throws org.apache.maven.plugin.MojoExecutionException
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
configureProxyServerSettings
protected void configureProxyServerSettings() throws org.apache.maven.plugin.MojoExecutionException
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
createWsdlOptionsFromScansAndExplicitWsdlOptions
protected abstract List<GenericWsdlOption> createWsdlOptionsFromScansAndExplicitWsdlOptions() throws org.apache.maven.plugin.MojoExecutionException
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
deleteDir
protected boolean deleteDir(File f)
Recursively delete the given directory- Parameters:
f
-- Returns:
-
getMarkerSuffix
protected abstract String getMarkerSuffix()
-
generateCommandLine
protected List<String> generateCommandLine(GenericWsdlOption wsdlOption) throws org.apache.maven.plugin.MojoExecutionException
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
forkOnce
protected void forkOnce(Set<URI> classPath, List<GenericWsdlOption> effectiveWsdlOptions) throws org.apache.maven.plugin.MojoExecutionException
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
getForkClass
protected abstract Class<?> getForkClass()
-
getGeneratedSourceRoot
protected abstract File getGeneratedSourceRoot()
-
getGeneratedTestRoot
protected abstract File getGeneratedTestRoot()
-
runForked
protected void runForked(Set<URI> classPath, String mainClassName, String[] args) throws org.apache.maven.plugin.MojoExecutionException
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
shouldRun
protected abstract boolean shouldRun(GenericWsdlOption wsdlOption, File doneFile, URI wsdlURI)
Determine if code should be generated from the given wsdl- Parameters:
wsdlOption
-doneFile
-wsdlURI
-- Returns:
-
createMarkerFile
protected void createMarkerFile(GenericWsdlOption wsdlOption, File doneFile, URI wsdlURI) throws IOException
- Throws:
IOException
-
getWsdlFile
public File getWsdlFile(GenericWsdlOption option, File baseDir)
Try to find a file matching the wsdl path (either absolutely, relatively to the current dir or to the project base dir)- Returns:
- wsdl file
-
getWsdlURI
public URI getWsdlURI(GenericWsdlOption option, URI baseURI) throws org.apache.maven.plugin.MojoExecutionException
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
downloadRemoteWsdls
protected void downloadRemoteWsdls(List<GenericWsdlOption> effectiveWsdlOptions) throws org.apache.maven.plugin.MojoExecutionException
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
-