Reputation: 8042
I have two Maven projects we'll call Inside and Outside. They are built with maven-assembly-plugin. I want to include Inside in Outside, so we'll have one big project and all the jars and wars of Inside will be in Outside when it is built.
I have added Inside as a dependency of Outside in Outside's pom.xml. In both cases, maven-assembly-plugin refers to a file called assembly.xml. I have added the contents of Inside's assembly.xml to Outside's assembly.xml.
This has not worked. I suppose the problem is that the actual files of Inside are not in Outside, so making references to them has no effect. I do not know how to refer to files that are inside a maven dependency.
So how can I add Inside to Outside?
Upvotes: 1
Views: 200
Reputation: 328754
Don't include Inside's assembly.xml
into Outside, instead modify the assembly.xml
of Outside to consider the dependencies when building the assembly.
Have a look at the jar-with-dependencies
descriptor to see how you can include all dependencies into your JAR.
Note that the Java JAR format isn't really suited to "include" dependencies. If you want to build something that contains all the code, use a ZIP archive. If you want to deploy, a WAR.
If you want to build a WAR, use the Maven WAR plugin instead since it already knows how to include dependencies in the result.
Upvotes: 2