Skip to content
Advertisement

Correct way to build “live” directory structure after maven build?

I have a multi module maven project which looks something like:

  • main
    • component_one
      • subcomponent_bob
      • subcomponent_mike
      • subcomponent_joe
    • component_one_aggregate
    • component_two
      • subcomponent_tim
      • subcomponent_lary
    • component_two_aggregate

The aggregate projects create parent jars for each of the components containing all of their subcomponents.

I have a pom in each directory, and it all deploys to a local repository. Everything works great!

Except that I would like to have the directory strucuture that “ties it all together” be created as well, something like:

  • main
    • deploy
      • server
        • lib
          • component_one.jar
        • .. other stuff, start scripts, configs, etc
      • client
        • lib
          • component_two.jar
        • … other stuff, start scripts, etc

I’m looking for the “right” way to do this.

I’ve figured out a variety of hacky ways to do this involving post deploy goals, antrun, etc. I simply can’t find evidence for this being possible in a “correct” way, is this simply outside the scope of maven?

I’ve been thinking of creating a Makefile to wrap maven and some bash scripts to move the files around post maven deploy, but I still feel like this isn’t a great way of doing it either.

What am I misisng?

Advertisement

Answer

You can create such a structure via the Maven-Assembly-Plugin.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement