Kris,

Thanks for the suggestion! However, I don't see a way to do what I'm describing using the maven-dependency-plugin's dependency:unpack. Specifically I don't see a way to:

1) "patch" an existing maven project's source (by copying the original project to a temp location, copying files atop it, deleting files as required) 2) build the patched project (by building the project in the temp location, then moving the artifacts in its target directory to some target directory, like the current project's target directory)

If I wasn't trying to actually change the source of the original project (which I don't need to do for the current project I'm working on, but have needed to do in some other projects recently, although I used Ant scripts for that, which I'd like to replace with this plugin possibly) then I could just call the original maven2 build (by making it a dependent module I guess?), then unpacking the target/...war from that directory to some location using the maven-dependency-plugin, but then I'm not sure how I would use the maven-dependency plugin to only copy over the files I was interested in changing, and then I'm not sure how I could re-war up all of those files using Maven 2.

I have no problem just writing a new plugin if there is no existing way to do this, but I definitely don't want to recreate the wheel if there is a better way.

(Note to everyone: if you think I should write this plugin, maybe a better name than overlay would be the "patch" plugin?)

Thanks,
Gary


Kris Bravo wrote:
Hi Gary,

The Maven dependency plugin, http://maven.apache.org/plugins/maven-dependency-plugin/, can be used to do what you describe, except that it's based on the results of a maven project instead of the project itself. Check out the unpack goal.

Kris

Gary Weaver wrote:
Hey guys,

I'm getting ready to start writing a (hopefully relatively simple) Maven 2 plugin that basically can copy an existing project directory into a temporary location, overlay (copy over) files from the src/main directory into the same relative positions/hierarchy in the temporary directory, and then call the build in the temporary directory.

The intent (maybe there is a much easier way of doing this) is to be able to easily modify and repackage existing open-source projects with local modifications.

I have written a few ant scripts to do similar for other projects in the past, but for 3 projects that I'm getting ready to work on, I need to replace files (such as spring and webapp configuration files) and possibly others, and I'd rather do that in a Maven project and produce packages that contain the appropriate configuration rather than modifying those config files on the various servers.

Here is how I think it would work:

* You'd specify the following parameters to the plugin in the pom:

- "originalDirPath" - Path of the directory with the original project
- "tempDirPath" - (optional - if not specified, it uses some default directory) Path to the temporary directory - "overlayDirPath" - (optional - if not specified, it uses some default directory) Path to the directory containing hierarchy of files/dirs to overlay atop (replace) original files that were copied to temporary directory - "dirsAndFilesToRemovePriorToOverlay" - (optional) A list of files/directories to remove from the temporary directory, prior to copying overlay files/dirs, possibly optionally being able to specify them as regular expressions

* When the plugin was called, it would first recursively copy from "originalDirPath" to "tempDirPath". Then it would delete files and directories if specified as "dirsAndFilesToRemovePriorToOverlay" (directories would recursively delete subdirs, etc.). Then it would recursively copy files and dirs from "overlayDirPath" to "tempDirPath". It would then call the Maven 2 build in "tempDirPath". Finally it would copy the target directory from tempDirPath/target to ./target.

I don't really need "dirsAndFilesToRemovePriorToOverlay" other than possibly to eliminate garbage like "*~" "#*" and svn files, but I thought it might be helpful for others.

I'd also really like it to call external Ant builds as well (I could use that for 2 other projects that I was previously using a similar Ant script to do the same thing), but I probably wouldn't do that in the first version.

So, my two questions are:

1) If there is a more standard/more widely used way of accomplishing what I'm trying to accomplish without writing such a plugin, could you describe it?

2) Assuming this plugin would be useful to others, would anyone be interested in me hosting this plugin in mojo.codehaus.org after it is developed?

Thanks!

Gary




--
Gary Weaver
Internet Framework Services
Office of Information Technology
Duke University


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email


Reply via email to