Index: pom.xml =================================================================== RCS file: /home/projects/xdoclet/scm/maven2-plugin/pom.xml,v retrieving revision 1.2 diff -u -r1.2 pom.xml --- pom.xml 23 Dec 2005 01:32:38 -0000 1.2 +++ pom.xml 1 Jan 2006 14:26:44 -0000 @@ -43,7 +43,7 @@ commons-jelly commons-jelly-tags-xml - 20050823.222913 + 1.0 runtime @@ -64,20 +64,20 @@ org.apache.maven maven-plugin-api - 2.0 + 2.0.1 org.apache.maven maven-project - 2.0 + 2.0.1 dist.codehaus.org - legacy http://dist.codehaus.org + legacy Index: src/main/java/org/codehaus/xdoclet/Config.java =================================================================== RCS file: /home/projects/xdoclet/scm/maven2-plugin/src/main/java/org/codehaus/xdoclet/Config.java,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 Config.java --- src/main/java/org/codehaus/xdoclet/Config.java 23 Dec 2005 00:44:41 -0000 1.1.1.1 +++ src/main/java/org/codehaus/xdoclet/Config.java 1 Jan 2006 14:26:44 -0000 @@ -16,6 +16,7 @@ private Set excludes = new HashSet(); private String encoding = System.getProperty("file.encoding"); private Map params = new HashMap(); + private boolean addSourceRoot = false; public String getPlugin() { return plugin; @@ -57,12 +58,21 @@ this.params = params; } + public boolean isAddSourceRoot() { + return addSourceRoot; + } + + public void setAddSourceRoot(boolean addSourceRoot) { + this.addSourceRoot = addSourceRoot; + } + public String toString() { return "Config{" + "plugin='" + plugin + '\'' + ", includes=" + includes + ", excludes=" + excludes + ", encoding='" + encoding + '\'' + + ", addSourceRoot='" + addSourceRoot + '\'' + ", params=" + params + '}'; } Index: src/main/java/org/codehaus/xdoclet/XDocletMojo.java =================================================================== RCS file: /home/projects/xdoclet/scm/maven2-plugin/src/main/java/org/codehaus/xdoclet/XDocletMojo.java,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 XDocletMojo.java --- src/main/java/org/codehaus/xdoclet/XDocletMojo.java 23 Dec 2005 00:44:41 -0000 1.1.1.1 +++ src/main/java/org/codehaus/xdoclet/XDocletMojo.java 1 Jan 2006 14:26:44 -0000 @@ -57,7 +57,7 @@ * @required */ private List configs = new LinkedList(); - + public MavenProject getProject() { return project; } @@ -99,7 +99,15 @@ } throw new MojoExecutionException("Undeclared: ", ex); } catch (RuntimeException e) { - throw new MojoFailureException(e.getMessage()); + throw new MojoFailureException(null, "XDoclet plugin failed", e.getCause().getMessage()); + } + if (config.isAddSourceRoot()) { + String addedSourceRoot = resolveOutputDir(config, outputDir); + if ( project != null ) + { + getLog().info("Adding " + addedSourceRoot + " to compiler path"); + project.addCompileSourceRoot(addedSourceRoot); + } } } } @@ -108,6 +116,23 @@ resource.setDirectory(outputDir); //resource.addInclude("* * / *.xml"); project.addResource(resource); + } + + private String resolveOutputDir(Config config, String outputDir) { + String sourceRoot = outputDir; + Map params = config.getParams(); + if (params != null) { + String destDir = null;; + try { + destDir = (String)params.get("destdir"); + } catch (RuntimeException e) { + // ignore .... + } + if (destDir != null) { + sourceRoot = destDir; + } + } + return sourceRoot; } private File getSourceRoot() { Index: src/test/java/META-INF/MANIFEST.MF =================================================================== RCS file: src/test/java/META-INF/MANIFEST.MF diff -N src/test/java/META-INF/MANIFEST.MF --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/test/java/META-INF/MANIFEST.MF 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Class-Path: +