Skip to content

Commit

Permalink
Fixes #44.
Browse files Browse the repository at this point in the history
  • Loading branch information
lennartj committed May 26, 2016
1 parent d6d49f2 commit f460f4a
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/main/java/org/codehaus/mojo/jaxb2/AbstractJaxbMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public abstract class AbstractJaxbMojo extends AbstractMojo {
tmp.add(new PatternFileFilter(Arrays.asList(STANDARD_EXCLUDE_SUFFIXES), true));

// Make STANDARD_EXCLUDE_FILTERS be unmodifiable.
STANDARD_EXCLUDE_FILTERS = (List<Filter<File>>) Collections.unmodifiableList(tmp);
STANDARD_EXCLUDE_FILTERS = Collections.unmodifiableList(tmp);
}

/**
Expand Down Expand Up @@ -269,6 +269,20 @@ public final void execute() throws MojoExecutionException, MojoFailureException
} else if (isInfoEnabled) {
log.info("No changes detected in schema or binding files - skipping JAXB generation.");
}

// 4) If the output directories exist, add them to the MavenProject's source directories
if(getOutputDirectory().exists() && getOutputDirectory().isDirectory()) {

final String canonicalPathToOutputDirectory = FileSystemUtilities.getCanonicalPath(getOutputDirectory());

if(log.isDebugEnabled()) {
log.debug("Adding existing JAXB outputDirectory [" + canonicalPathToOutputDirectory
+ "] to Maven's sources.");
}

// Add the output Directory.
getProject().addCompileSourceRoot(canonicalPathToOutputDirectory);
}
}

/**
Expand Down Expand Up @@ -457,8 +471,8 @@ protected File getEpisodeFile(final String customEpisodeFileName) throws MojoExe
FileSystemUtilities.createDirectory(generatedMetaInfDirectory, false);
if (getLog().isDebugEnabled()) {
getLog().debug("Created episode directory ["
+ FileSystemUtilities.getCanonicalPath(generatedMetaInfDirectory) + "]: " +
generatedMetaInfDirectory.exists());
+ FileSystemUtilities.getCanonicalPath(generatedMetaInfDirectory) + "]: "
+ generatedMetaInfDirectory.exists());
}
}

Expand Down

0 comments on commit f460f4a

Please sign in to comment.