I have the following project structure:
parent (packing: pom)
+ framework (packing: jar)
+ plugins (packing: pom)
+ plugin_1 (packing: pom)
+ impl (packing: jar)
+ e2e_test (packing: jar)
+ plugin_2 (packing: pom)
+ impl (packing: jar)
+ e2e_test (packing: jar)
Inside the plugin_1.impl
and plugin_2.impl
I have a resource.xml
which describes the plugin.
The build is fine, meaning when I want to build the whole project it builds in order. However the installation fails to create the same structure. After install the local repository looks like this:
com/company
+ parent/version
+ pom file
+ framework/version
+ jars
+ plugins/version
+ pom file
+ plugin_1/version
+ pom file
+ plugin_1.impl/version
+ jar
+ plugin_1.e2e_tests/version
+ jar
+ plugin_2/version
+ pom file
+ plugin_2.impl/version
+ jar
+ plugin_2.e2e_tests/version
+ jar
But I want:
com/company/parent/version
+ framework.jar
+ plugins
+ plugin_1.jar
+ plugin_1.xml (renamed resource.xml)
+ plugin_2.jar
+ plugin_2.xml (renamed resource.xml)
Is there a way to create the desired structure?
I have tried maven-install-plugin
e.g.:
mvn org.apache.maven.plugins:maven-install-plugin:3.0.0-M1:install-file \
-Dfile=parent/plugins/plugin_1/impl/resource.xml \
-DgroupId=com.company \
-DartifactId=parent \
-Dversion=1.0-SNAPSHOT \
-Dpackaging=file \
-DgeneratePom=true
or the pom.xml
equivalent of this (but for the jar):
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>3.0.0-M1</version>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>install-file</goal>
</goals>
<configuration>
<groupId>${project.groupId}</groupId>
<artifactId>${project.parent.parent.artifactId}</artifactId>
<version>${project.version}</version>
<packaging>jar</packaging>
<file>${project.build.directory}/${project.build.finalName}.jar</file>
</configuration>
</execution>
</executions>
</plugin>
But this will always rename the file according to the artifactId
and I end up overwriting the same file.
I was able to create the described structure by using copy-rename-maven-plugin
inside the upmost parent's target directory.
I want this structure because:
- The
framework
can use anyjar
put inside theplugins
directory with a proper descriptor. - I don't want to do this by hand every time I recompile or change something inside multiple plugins.
- End to end tests for a module works by calling
framework plugin_1 (args)
inside a test and checks the result. For this I need working structure inside a local repository for the test project to depend on.
Is there a way to create the desired structure inside local repository?