0

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>

Community
  • 1
  • 1
Kevin Streicher
  • 484
  • 1
  • 8
  • 25

1 Answers1

0

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>
Kevin Streicher
  • 484
  • 1
  • 8
  • 25