Skip to content

Commit

Permalink
Release 1.0 and update Strings to File objects
Browse files Browse the repository at this point in the history
git-svn-id: file:///home/tiste/MOJOHAUS-TO-GIT/SVN-MOJO-WIP/trunk/mojo/jaxb2-maven-plugin@1815 52ab4f32-60fc-0310-b215-8acea882cd1b
  • Loading branch information
jgenender committed Apr 11, 2006
1 parent 3a73613 commit d2e251c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 18 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<artifactId>jaxb2-maven-plugin</artifactId>
<packaging>maven-plugin</packaging>
<name>Maven JAXB 2.0 Plugin</name>
<version>1.0-SNAPSHOT</version>
<version>1.0</version>
<url>http://mojo.codehaus.org/jaxb2-maven-plugin/</url>
<ciManagement>
<system>continuum</system>
Expand Down
31 changes: 14 additions & 17 deletions src/main/java/org/codehaus/mojo/jaxb2/XjcMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public class XjcMojo extends AbstractMojo {
* @parameter expression="${basedir}/target/jaxb-source"
* @required
*/
protected String outputDirectory;
protected File outputDirectory;

/**
* The package in which the source files will be generated.
Expand All @@ -74,7 +74,7 @@ public class XjcMojo extends AbstractMojo {
*
* @parameter
*/
protected String catalog;
protected File catalog;

/**
* Set HTTP/HTTPS proxy. Format is [user[:password]@]proxyHost[:proxyPort]
Expand All @@ -89,14 +89,14 @@ public class XjcMojo extends AbstractMojo {
* @parameter expression="${basedir}/src/main/xsd"
* @required
*/
protected String schemaDirectory;
protected File schemaDirectory;

/**
* The binding directory for xjb files
*
* @parameter expression="${basedir}/src/main/xjb"
*/
protected String bindingDirectory;
protected File bindingDirectory;

/**
* List of files to use for bindings, comma delimited. If none, then all xjb
Expand Down Expand Up @@ -204,15 +204,14 @@ public void execute() throws MojoExecutionException {
try {
if (isOutputStale()) {
getLog().info("Generating source...");
File outDir = new File(outputDirectory);

//If the directory exists, whack it to start fresh
if (outDir.exists())
deleteDir(outDir);
boolean success = outDir.mkdirs();
if (outputDirectory.exists())
deleteDir(outputDirectory);
boolean success = outputDirectory.mkdirs();
if (!success) {
throw new MojoExecutionException(
"Could not create directory " + outputDirectory);
"Could not create directory " + outputDirectory.getAbsolutePath());
}

// Need to build a URLClassloader since Maven removed it form
Expand Down Expand Up @@ -262,7 +261,7 @@ public void execute() throws MojoExecutionException {
getLog().info("No changes detected in schema or binding files, skipping source generation.");
}

project.addCompileSourceRoot(outputDirectory);
project.addCompileSourceRoot(outputDirectory.getAbsolutePath());

} catch (MojoExecutionException e) {
throw e;
Expand Down Expand Up @@ -318,15 +317,15 @@ private ArrayList<String> getXJCArgs(String classPath)

if (catalog != null) {
args.add("-catalog");
args.add(catalog);
args.add(catalog.getAbsolutePath());
}

if (extension) {
args.add("-extension");
}

args.add("-d");
args.add(outputDirectory);
args.add(outputDirectory.getAbsolutePath());
args.add("-classpath");
args.add(classPath);

Expand All @@ -344,7 +343,7 @@ private ArrayList<String> getXJCArgs(String classPath)
args.add(xsds[i].getAbsolutePath());
}
} else {
args.add(schemaDirectory);
args.add(schemaDirectory.getAbsolutePath());
}

getLog().debug("JAXB 2.0 args: " + args);
Expand All @@ -368,8 +367,7 @@ public final File[] getBindingFiles() {
}
} else {
getLog().debug("The binding Directory is " + bindingDirectory);
File bindingDir = new File(bindingDirectory);
File[] files = bindingDir.listFiles(new XJBFile());
File[] files = bindingDirectory.listFiles(new XJBFile());
if (files != null) {
for (int i = 0; i < files.length; i++) {
bindings.add(files[i]);
Expand All @@ -396,8 +394,7 @@ public final File[] getXSDFiles() {
}
} else {
getLog().debug("The schema Directory is " + schemaDirectory);
File schemaDir = new File(schemaDirectory);
File[] files = schemaDir.listFiles(new XSDFile());
File[] files = schemaDirectory.listFiles(new XSDFile());
if (files != null) {
for (int i = 0; i < files.length; i++) {
xsdFiles.add(files[i]);
Expand Down

0 comments on commit d2e251c

Please sign in to comment.