How could I deploy multiple maven artifacts to multiple nexus repositories including snapshot repositories without having to specify a profile? - maven

We have a gateway-client project that is part of a multi-module maven project. The gateway-client pom.xml is configured to create two main artifacts: gateway-client.jar and gateway-services-client.jar and deploy them to two separate Nexus repositories: the Releases repo and the 3rd Party repo respectively. This is done through a profile that is active by default:
<profile>
<!-- ====================================================================== -->
<!-- default Profile -->
<!-- This is the default profile which will run by default. This profile -->
<!-- produces two client artifacts: gateway-client and gateway-services-client -->
<!-- for the releases and thirdparty repositories respectively. -->
<!-- ====================================================================== -->
<id>default</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<!-- ====================================================================== -->
<!-- default Profile Build plugins -->
<!-- ====================================================================== -->
<build>
<plugins>
<!-- ====================================================================== -->
<!-- default Profile Maven deploy plugin -->
<!-- ====================================================================== -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
<executions>
<execution>
<id>deploy-thirdparty-jar</id>
<phase>deploy</phase>
<goals>
<goal>deploy-file</goal>
</goals>
<configuration>
<url>${nexus.url}/content/repositories/thirdparty</url>
<repositoryId>thirdparty</repositoryId>
<file>${project.build.directory}/${project.build.finalName}.${project.packaging}</file>
<groupId>${project.groupId}</groupId>
<artifactId>gateway-services-client</artifactId>
<version>${project.version}</version>
<packaging>jar</packaging>
<generatePom>true</generatePom>
</configuration>
</execution>
<execution>
<id>deploy-release-jar</id>
<phase>deploy</phase>
<goals>
<goal>deploy-file</goal>
</goals>
<configuration>
<url>${nexus.url}/content/repositories/releases</url>
<repositoryId>releases</repositoryId>
<file>${project.build.directory}/${project.build.finalName}.${project.packaging}</file>
<groupId>${project.groupId}</groupId>
<artifactId>gateway-client</artifactId>
<version>${project.version}</version>
<packaging>jar</packaging>
<generatePom>true</generatePom>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
The problem is that because this profile is active by default, if we try to run a mvn deploy and the version of the GAV coordinates is a -SNAPSHOT, the build unintentionally still tries to deploy to Nexus 3rd Party and Releases repos and fails because of course it won't accept -SNAPSHOT artifact versions. To get around this, I setup a profile specifically for -SNAPSHOT versions which will only deploy to the Snapshot repository:
<profile>
<!-- ====================================================================== -->
<!-- snapshot Profile -->
<!-- Activating this profile will automatically deactivate the default profile. -->
<!-- The purpose of this profile is to produce a a gateway-services-client and gateway-client -->
<!-- snapshot artifacts and deploy them to the snapshots Nexus repository where they can -->
<!-- act as the latest development dependencies for other projects -->
<!-- ====================================================================== -->
<id>snapshot</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<!-- ====================================================================== -->
<!-- snapshot profile Build plugins -->
<!-- ====================================================================== -->
<build>
<plugins>
<!-- ====================================================================== -->
<!-- snapshot profile Maven deploy plugin -->
<!-- ====================================================================== -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
<executions>
<execution>
<id>deploy-thirdparty-snapshot-jar</id>
<phase>deploy</phase>
<goals>
<goal>deploy-file</goal>
</goals>
<configuration>
<url>${nexus.url}/content/repositories/snapshots</url>
<repositoryId>snapshots</repositoryId>
<file>${project.build.directory}/${project.build.finalName}.${project.packaging}</file>
<groupId>${project.groupId}</groupId>
<artifactId>gateway-services-client</artifactId>
<version>${project.version}</version>
<packaging>jar</packaging>
<generatePom>true</generatePom>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
The problem with this is that you must specify the profile when executing the Maven command: mvn deploy -P 'snapshot'. My question is what can I do so that all I have to do is run mvn deploy without specifying the snapshot profile and have the build automatically deploy to the snapshot repository or to the 3rd Party and Releases repositories all based on the presense of -SNAPSHOT in the version of the GAV coordinates?

The only solution that comes to my mind is using properties and adding three executions during deployment. The ugly thing is that in case of SNAPSHOT your artifact would be deployed twice to the same repository.
Here is what you could do:
<plugin>
<groupId>org.codehaus.groovy.maven</groupId>
<artifactId>gmaven-plugin</artifactId>
<version>1.0</version>
<executions>
<execution>
<id>eval-repo</id>
<phase>initialize</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<source>
if (project.version.endsWith("-SNAPSHOT")){
project.properties.repoId = "snapshots";
project.properties.repoUrl = "snapshots url";
project.properties.thirdPartyRepoId = "snapshots";
project.properties.thirdPartyRepoUrl = "snapshots url";
}
else {
project.properties.repoId = "releases";
project.properties.repoUrl = "releases url";
project.properties.thirdPartyRepoId = "thirdparty";
project.properties.thirdPartyRepoUrl = "thirdparty url";
}
</source>
</configuration>
</execution>
</executions>
</plugin>
Then add three executions with the following configurations:
<configuration>
<artifactId>gateway-client</artifactId>
<url>${repoUrl}</url>
<repositoryId>${repoId}</repositoryId>
...
<configuration>
<artifactId>gateway-services-client</artifactId>
<url>${repoUrl}</url>
<repositoryId>${repoId}</repositoryId>
...
<configuration>
<artifactId>gateway-services-client</artifactId>
<url>${thirdPartyRepoId}</url>
<repositoryId>${thirdPartyRepoUrl}</repositoryId>
...

You can't do it with profiles. From the maven doc:
A profile can be triggered/activated in several ways:
Explicitly
Through Maven settings
Based on environment variables
OS settings
Present or missing files
So you can't do it the way you want it. However, we do this all the time. Our setup is we use the following in our super-pom
<distributionManagement>
<repository>
<id>deploymentRepo</id><!-- key in settings.xml -->
<name>Releases</name>
<uniqueVersion>false</uniqueVersion>
<url>${repos.release}</url>
<layout>default</layout>
</repository>
<snapshotRepository>
<id>deploymentRepo</id>
<name>Snapshots</name>
<uniqueVersion>true</uniqueVersion>
<url>${repos.snapshot}</url>
<layout>default</layout>
</snapshotRepository>
</distributionManagement>
Note the id is the same because both repos use the same credential.
We are also using nexus where each repo is configured as snapshot or release and just with this, maven is capable of knowing that *-SNAPSHOT goes to the snapshot repo.
In other words, just give both options at the same time, don't put them in mutually exclusive profiles, and maven will know which way to send them. If it doesn't, try a repo manager

Related

Parent POM is not flattened when deployed to Nexus

I have a multi-module Maven project where the project version is set via the revision variable.
<groupId>pricing</groupId>
<artifactId>pricing-backend-pom</artifactId>
<version>${revision}</version>
<packaging>pom</packaging>
<properties>
<revision>3.0.7</revision>
</properties>
<modules>
<module>pricing-backend-war</module>
<module>pricing-backend-model</module>
<module>pricing-backend-client</module>
</modules>
<build>
<plugins>
<!-- flatten before deploy. removes $revision -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<version>1.2.7</version>
<configuration>
</configuration>
<executions>
<!-- enable flattening -->
<execution>
<id>flatten</id>
<phase>process-resources</phase>
<goals>
<goal>flatten</goal>
</goals>
</execution>
<!-- ensure proper cleanup -->
<execution>
<id>flatten.clean</id>
<phase>clean</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
During the Gitlab build, the project is deployed to a Nexus repository. Each module and the parent appear in Nexus but only the modules appear to be flattened. The module POMs each contain <version>3.0.7</version> but the parent POM still contains <version>${revision}</version>.
I find it difficult to understand why the parent is deployed differently to the modules. I have checked the build logs but cannot see any indication that the parent is handled in a different way.
The parent POM taken from Nexus:
<groupId>pricing</groupId>
<artifactId>pricing-backend-pom</artifactId>
<version>${revision}</version>
<packaging>pom</packaging>
<properties>
<revision>3.0.7</revision>
...
A module POM:
<groupId>pricing</groupId>
<artifactId>pricing-backend-client</artifactId>
<version>3.0.7</version>
<dependencies>
...
The build applies the required version:
$ echo New version= ${MAVEN_VERSION}
New version= -Drevision=3.0.7-SNAPSHOT
$ mvn $MAVEN_CLI_OPTS ${MAVEN_VERSION} deploy -DskipTests
The pom file to be installed can be explicitly set:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.4</version>
<configuration>
<pomFile>.flattened-pom.xml</pomFile>
</configuration>
</plugin>
Above, flatten-maven-plugin has been previously invoked to produce .flattened-pom.xml
If you do a test by adding -Drevision=<someVersion> to the command line, does that produce correct results in Nexus?
I suspect it will.
Properties are interpolated very early in the process. When the command first runs, ${revision} is undefined, so Maven leaves it as-is. The flatten then calculates ${revision}, but that only applies from the time the plugin runs and later.
You can try researching "late binding" properties (they start with '#' instead of '$') but I'm not sure if those work in top level fields like the GAV coords.

Fitnesse server not opening tests suite from src/test/fitnesse

For below Maven plugin. wehn I try to run
mvn verify -DskipTests -P wiki
Fitnesse Server launches with default FrontPage Suite not with MyTest.
I want to launch server that should open MyTest suite, so that I can edit that make changes directly in src/test/fitnesse folder directly
<profile>
<id>wiki</id>
<build>
<plugins>
<plugin>
<groupId>uk.co.javahelp.fitnesse</groupId>
<artifactId>fitnesse-launcher-maven-plugin</artifactId>
<configuration>
<port>9122</port>
<workingDir>${project.build.directory}/fitnesse</workingDir>
<root>FitNesseRoot</root>
<testResourceDirectory>src/test/fitnesse</testResourceDirectory>
<reportsDir>${project.build.directory}/fitnesse/reports</reportsDir>
<resultsDir>${project.build.directory}/fitnesse/results</resultsDir>
<summaryFile>${project.build.directory}/fitnesse/results/failsafe-summary.xml</summaryFile>
<createSymLink>true</createSymLink>
<excludeOptionalDependencies>true</excludeOptionalDependencies> <!-- Deprecated -->
<deletePluginsProperties>false</deletePluginsProperties> <!-- Note the 's' in "plugins" -->
<alwaysUnpackFitnesse>false</alwaysUnpackFitnesse>
<failIfNoTests>false</failIfNoTests>
<useProjectDependencies>
<!-- Any combination of scopes -->
<scope>system</scope>
<scope>compile</scope>
<scope>provided</scope>
<scope>runtime</scope>
<scope>test</scope>
</useProjectDependencies>
<launches>
<launch>
<suite>MyTest</suite>
</launch>
</launches>
</configuration>
<executions>
<execution>
<goals>
<goal>set-up</goal>
<goal>wiki</goal>
<goal>tear-down</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
Add below configuration in Configuration tag
<configuration>
<suite>YourSuitePageName</suite>
</configuration>

In maven, how to override plugin configuration in settings.xml

I want to override a particular plugin configuration that's defined in the pom.xml. I don't want to modify the pom.xml for various reasons. Is there a way to define a config attribute for that plugin in settings.xml that override corresponding pom.xml plugin config?
In the below example, you'll notice that the plugin xx-plugin is defined in profile1 in pom.xml. In my settings.xml I've already defined profile2 to override property prop1 from pom.xml. But how to override config3. I apologize if this is a silly question. I am a little new to maven.
This is what my pom.xml looks like:
<profile>
<id>profile1</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>com.xx.yyy</groupId>
<artifactId>xx-plugin</artifactId>
<executions>
<execution>
<id>xx-install</id>
<phase>install</phase>
<goals>
<goal>xx-install</goal>
</goals>
<configuration>
<config1>AAA</config1>
<config2>BBB</config2>
<config3>CCC</config3> <!-- I want to override this with value DDD -->
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
This is what my settings.xml looks like:
<profile>
<id>profile2</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<prop1>overriden-value</prop1> <!-- This works -->
</properties>
<!-- Somehow override config3 here -->
<!-- <config3>DDD</config3> -->
</profile>
AFAIK you can only override properties with settings.xml profiles. You'd have to change your plugin's configuration to use a property instead of a fixed value:
<!-- define your property -->
<properties>
<prop1>CCC</prop1>
</properties>
<profile>
<id>profile1</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>com.xx.yyy</groupId>
<artifactId>xx-plugin</artifactId>
<executions>
<execution>
<id>xx-install</id>
<phase>install</phase>
<goals>
<goal>xx-install</goal>
</goals>
<configuration>
<config1>AAA</config1>
<config2>BBB</config2>
<config3>${prop1}</config3> <!-- I want to override this with value DDD -->
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
Remember that profiles with activeByDefault set to true will get deactivated if any other profile gets activated in your build invocation. See http://maven.apache.org/guides/introduction/introduction-to-profiles.html
If you do not want to change the pom.xml for a plugin you can set the configuration as JVM parameter when running maven as stated in the Generic Configuration chapter of the Maven Guide to Configuring Plugins.
Example:
mvn my-plugin:my-goal -Dplugin.property=ABC
Example for the wildfly plugin (this is where I needed it and did not want to change the pom.xml of a demo project when deploying to a server group in a domain context):
mvn clean install wildfly:deploy -Dwildfly.serverGroups=<server-group-name>
The maven documentation also states that most plugins define help goals to explain users how to configure them.
Exaple for the wildfly plugin:
mvn wildfly:help -Dgoal=deploy -Ddetail

Aggregate findbugs report in Maven 3.0.5

I am using multi-module Maven Project ( more than 10 modules ). I am trying to create a findbugs report of all module in single html page. Is there any way?
For creating individual report for each module, i am using the below
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<!--
Enables analysis which takes more memory but finds more bugs.
If you run out of memory, changes the value of the effort element
to 'Low'.
-->
<effort>Max</effort>
<!-- Build doesn't fail if problems are found -->
<failOnError>false</failOnError>
<!-- Reports all bugs (other values are medium and max) -->
<threshold>Low</threshold>
<!-- Produces XML report -->
<xmlOutput>false</xmlOutput>
<skip>${skipFindbugs}</skip>
<!-- Configures the directory in which the XML report is created -->
<findbugsXmlOutputDirectory>${project.build.directory}/findbugs</findbugsXmlOutputDirectory>
</configuration>
<executions>
<!--
Ensures that FindBugs inspects source code when project is compiled.
-->
<execution>
<phase>compile</phase>
<goals>
<goal>findbugs</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>xml-maven-plugin</artifactId>
<version>1.0</version>
<configuration>
<transformationSets>
<transformationSet>
<!-- Configures the source directory of XML files. -->
<dir>${project.build.directory}/findbugs</dir>
<!-- Configures the directory in which the FindBugs report is written.-->
<outputDir>${project.build.directory}/findbugs</outputDir>
<!-- Selects the used stylesheet. -->
<!-- <stylesheet>fancy-hist.xsl</stylesheet> -->
<stylesheet>${project.parent.basedir}/default.xsl</stylesheet>
<!--<stylesheet>plain.xsl</stylesheet>-->
<!--<stylesheet>fancy.xsl</stylesheet>-->
<!--<stylesheet>summary.xsl</stylesheet>-->
<fileMappers>
<!-- Configures the file extension of the output files. -->
<fileMapper implementation="org.codehaus.plexus.components.io.filemappers.FileExtensionMapper">
<targetExtension>.html</targetExtension>
</fileMapper>
</fileMappers>
</transformationSet>
</transformationSets>
</configuration>
<executions>
<!-- Ensures that the XSLT transformation is run when the project is compiled. -->
<execution>
<phase>compile</phase>
<goals>
<goal>transform</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>findbugs</artifactId>
<version>3.0.0</version>
</dependency>
</dependencies>
</plugin>
According to official documentation of the plugin (question n. 1), it is not possible.
However, here is the approach I used to achieve it:
Add an additional module to your existing multimodule project. This additional module will only be used for reporting
Configure the Buildhelper Maven Plugin to dynamically add the source code of the other modules to the reporting module. Note: you can do the same for resources, if required.
Configure the Findbugs plugin only on the reporting module
Add the other modules as dependencies of the reporting module, in order to have the Maven reactor build to build it only at the end.
If required: you don't want the reporting module to be part of your default build, create a profile in the aggregator/parent module which redefines the modules element and add the reporting module to it. As such, only when the profile will be activated (i.e. via command line, on demand) the reporting module will be added and the aggregated report will be created.
As an example, in the aggregator/parent module you can define as following:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.sample</groupId>
<artifactId>findbugs-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>findbugs-module1</module>
<module>findbugs-module2</module>
</modules>
<profiles>
<profile>
<id>findbugs-reporting</id>
<modules>
<module>findbugs-module1</module>
<module>findbugs-module2</module>
<module>findbugs-reporting</module>
</modules>
</profile>
</profiles>
</project>
Note: the findbugs-reporting module is only added in the findbugs-reporting profile. By default, the build will ignore it.
In the findbugs-reporting module, configure the POM using the configuration you posted (findbugs and XML maven plugin) and also add as following:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.9.1</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>..\findbugs-module1\src\main\java</source>
<source>..\findbugs-module2\src\main\java</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
Note the added sources from other modules (change it according to your project).
Furthermore, we also need to add dependencies to the reporting module. It has to depend on other modules in order to be built at the end (and as such make sure to take the latest changes/sources from other modules). As an example:
<dependencies>
<dependency>
<groupId>com.sample</groupId>
<artifactId>findbugs-module1</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.sample</groupId>
<artifactId>findbugs-module2</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
Finally, you can invoke the reporting build as following from the aggregator/parent dir:
mvn clean install -Pfindbugs-reporting
As such, you will build the whole project and additionally activate the reporting module, which will dynamically include sources from other modules (as configured) and generate an aggregated report.
Depending on your needs, you can avoid the profile step (if you want it as part of your default build) or activate the profile by default (so that you can skip the reporting build deactivate it via -P!findbugs-reporting) or use the skipFindbugs property you already configured (and without the profile, in such a case).

Maven Repository on github duplicates whole folder structure with additional folder

I am using maven 3 with IDEA IntelliJ and the publishing process does work as mostly provided here Hosting a Maven repository on github but the folder structure on github does not match the local folder structure, which means if i pull changes i end up with a whole duplicated structure because locally it does add another folder /locallogback/ but only the first structure is pushed to github on deploy
.../at/midneid/....
.../locallogback/at/midneid/....
Instead it should be just like on github
.../at/midneid/....
And the pom.xml looks like
If I do remove either of the ${project.artifactId} entries it does not add the additional local folder locallogback BUT instead the publishing to github does not work anymore as i need to interrupt it, because instead of 12 files (correctly) it starts to generate 525 BLOBS where i have no idea why.
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>at.midneid.logging</groupId>
<artifactId>locallogback</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Local Logback</name>
<url>http://sr.midneid.at</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<github.global.server>github</github.global.server>
</properties>
<dependencies>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.0.13</version>
</dependency>
</dependencies>
<distributionManagement>
<repository>
<id>mvn.public.release</id>
<url>file://E:/Eigene Dokumente/Repositories/mvn/mvn.public/${project.artifactId}</url>
</repository>
</distributionManagement>
<build>
<plugins>
<plugin>
<groupId>com.github.github</groupId>
<artifactId>site-maven-plugin</artifactId>
<version>0.9</version>
<configuration>
<message>Maven artifacts for ${project.version}</message> <!-- git commit message -->
<noJekyll>true</noJekyll> <!-- disable webpage processing -->
<outputDirectory>E:/Eigene Dokumente/Repositories/mvn/mvn.public/${project.artifactId}</outputDirectory> <!-- matches distribution management repository url above -->
<branch>refs/heads/master</branch> <!-- remote branch name -->
<includes><include>**/*</include></includes>
<repositoryName>mvn</repositoryName> <!-- github repo name -->
<repositoryOwner>NoxMortem</repositoryOwner> <!-- github username -->
<merge>true</merge>
</configuration>
<executions>
<!-- run site-maven-plugin's 'site' target as part of the build's normal 'deploy' phase -->
<execution>
<goals>
<goal>site</goal>
</goals>
<phase>deploy</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
I am very sorry I posted the question but I just found a solution, altough it does look very odd, so any improvements are very much appreciated, which is why i won't mark this answer directly.
The reason the original tutorial uses the target folder seems to be because it is temporary and therefore it makes sense to deploy the artifacts there such that it will be deleted on maven clean.
The essential settings are therefore:
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.1</version>
<configuration>
<altDeploymentRepository>internal.repo::default::file://${project.build.directory}/mvn-repo</altDeploymentRepository>
</configuration>
</plugin>
<plugin>
<groupId>com.github.github</groupId>
<artifactId>site-maven-plugin</artifactId>
<version>0.9</version>
<configuration>
<message>Maven artifacts for ${project.version}</message><!-- git commit message -->
<noJekyll>true</noJekyll><!-- disable webpage processing -->
<outputDirectory>${project.build.directory}/mvn-repo</outputDirectory> <!-- matches distribution management repository url above -->
<branch>refs/heads/master</branch> <!-- remote branch name --> <includes><include>**/*</include></includes>
<repositoryName>mvn</repositoryName> <!-- github repo name -->
<repositoryOwner>NoxMortem</repositoryOwner> <!-- github username -->
<merge>true</merge>
</configuration>
<executions>
<!-- run site-maven-plugin's 'site' target as part of the build's normal 'deploy' phase -->
<execution>
<goals>
<goal>site</goal>
</goals>
<phase>deploy</phase>
</execution>
</executions>
</plugin>
It does solve the problem which is why i post the answer, although it is not perfect as I do not really understand why I do need the distributionManagement entry. It does not seem to change anything in that folder now, but if i remove it, the build does not work anymore.
<distributionManagement>
<repository>
<id>mvn.public.release</id>
<url>file://E:/Eigene Dokumente/Repositories/mvn/mvn.public/${project.artifactId}</url>
</repository>
</distributionManagement>

Resources