I have a maven multi-module project similar to this:
- myService-parent
| - myService
| - myService-openApiDocs
| - miService-eventsDefinition
That I would like to deploy on Nexus as a single artifact, like this:
Maven-repo
|- myService
| | - <version>
| | - maven-metadata.xml
| | - <my service artifact>
| | - myService.pom
| | - myService.jar
| | - myService-openApiDocs.zip
| | - myService-eventsDefinition.json
With the maven-metadata.xml
similar to this:
<metadata modelVersion="1.1.0">
<groupId>com.myCompany</groupId>
<artifactId>myService</artifactId>
<version>...</version>
<versioning>
<snapshot>
<timestamp>...</timestamp>
<buildNumber>...</buildNumber>
</snapshot>
<lastUpdated>...</lastUpdated>
<snapshotVersions>
<snapshotVersion>
<classifier>open-api-docs</classifier>
<extension>zip</extension>
<value>...</value>
<updated>...<updated>
</snapshotVersion>
<snapshotVersion>
<extension>jar</extension>
<value>...</value>
<updated>...</updated>
</snapshotVersion>
<snapshotVersion>
<extension>pom</extension>
<value>...</value>
<updated>...</updated>
</snapshotVersion>
<snapshotVersion>
<classifier>event-definitions</classifier>
<extension>json</extension>
<value>...</value>
<updated>...</updated>
</snapshotVersion>
</snapshotVersions>
</versioning>
</metadata>
But actually what I obtain on Nexus is the creation of one different artifact for each module, like this:
Maven-repo
|- myService-parent
| | - <version>
| | - maven-metadata.xml
| | - <my service-parent artifact>
| | - myService-parent.pom
|- myService
| | - <version>
| | - maven-metadata.xml
| | - <my service artifact>
| | - myService.pom
| | - myService.jar
|- myService-openApiDocs
| | - <version>
| | - maven-metadata.xml
| | - <my service-openApiDocs artifact>
| | - myService-openApiDocs.pom
| | - myService-openApiDocs.zip
|- myService-eventsDefinition
| | - <version>
| | - maven-metadata.xml
| | - <my service-eventsDefinition artifact>
| | - myService-eventsDefinition.pom
| | - myService-eventsDefinition.json
How can I define in maven the structure that the multi-module project has on nexus?
CodePudding user response:
No, there is no sensible way of doing this.
If you want one artifact in Nexus, then refactor the project to a single-module project that generates two attached side artifacts.