I have a maven project with several modules,
One of these modules produces a custom, binary file. I need this file as input in another module.
What I want to do, is to fetch this file as dependency an use it in an other module with the help of an ant-script.
I tries a lot with Maven Assembly Plugin and dependency:copy-dependencies plugin, but with no success
Thanks for any suggestions
I had a very similar requirement for a project of mine. I am trying to synthesize it here, I hope this could help you :
Let’s say that the project is structured as follow :
Let’s start with the projectfoo pom :
Easy….
Now the module 1 :
… and the descriptor file (src/main/assembly/resources.xml) :
I assume here that you have previously generated your binary resource one way or another and stored it in src/main/resources. What the code above does is just creating a zip artifact of your resource, this is a necessary step to ease its injection as a maven dependency in module2.
So, now we just have to add this zip artifact as a dependency in module 2 :
… and finally unzip it with the maven-dependency-plugin, ideally in the classpath of module2 (target/classes) :
… and that’s it !
Yannick.