Can Maven help in modifying dependencies, change them and package them back?

My task is this:

  • Take a dependency, which is a zip
  • Unpack the dependency
  • Run some Java code, add some new files
  • Assemble the dependency back, including the new files
  • After assembly, build it as another artifact.

My queries:

  1. The dependency coordinates need to be provided dynamically during build time. Am looking for something like SystemProperty, but not sure how to take them through my pom.
  2. Unpacking is straightforward. unpack-dependencies is all I need.
  3. Running Java code - Here's a hiccup again. This project doesn't produce a jar or a war, it's got to be a pom packaging. SO I cannot compile code in the project. I can use the compiler plugin with Java execution. Not sure it's a good practice.
  4. Not a problem to assemble, if I can get uptill here.

Any suggestions for points 1 and 3?

Thanks for the help.

Answers


Alot of the problems with Maven arise from the decision about which build "tasks" translate into discrete Maven builds. The general idea is that each jar, zip, or whatever your building should get it's own mave build ( aka pom, aka module ). Looking at your bullets, I believe you have three maven builds, i.e. three poms.

1) The first pom will build your Java utility, i.e. jar. This jar then becomes a dependency of your other build that needs to execute it as part of the zip assembly process.

2) The second pom will do build the zip. ( I guess you will actually build several different ones; most likely these are then separate poms -- while you can have a single build produce more than one artifact, leveraging the concept of attached artifacts and classifiers, it's an unnecessary complication that should be avoided unless you know you need it. ) These zip assembly poms unzip the primary zip, massage the content via the java util( running the jar via maven-exec plugin), and reassembles the zip.

3) If you need to change the name of an artifact ( your zip ) when it's consumed in the production of another artifact ( your framework ), then you can use the dependency plugins' copy goal. It allows you to specify new names for the dependencies that you are pulling into your build -- but note you aren't actually changing the maven coords, which, I believe, is something to be avoided like the plague. :)


Need Your Help

osx kernel debug cannot 'malloc_get_all_zones'

macos debugging kernel

I am doing some OSX kernel debugging with lldb and KDK.

UITextview text not showing top lines after rotation in iOS7

ios7 uitextview autolayout ios7.1

I have an app that contains a UITextview that displays static text. I used a UITextview to get scrolling for the text, which is much longer than can be displayed in a UILabel. For some reason, the ...