github上的Maven Repository使用附加文件夹复制整个文件夹结构

时间:2014-08-26 10:49:55

标签: maven github intellij-idea

我正在使用带有IDEA IntelliJ的maven 3,并且发布过程确实可以像Hosting a Maven repository on github 中提供的那样工作但是 github上的文件夹结构与本地文件夹结构不匹配,这意味着我拉动更改我最终得到一个完整的重复结构,因为本地它确实添加了另一个文件夹/ locallogback /但只有第一个结构被推送到部署的github

.../at/midneid/....
.../locallogback/at/midneid/....

相反它应该就像在github上一样

.../at/midneid/....

pom.xml看起来像

如果我确实删除了$ {project.artifactId}条目中的任何一个,它就不会添加额外的本地文件夹 locallogback ,而是发布到github不再有效,因为我需要中断它,因为它不是12个文件(正确)而是开始生成525 BLOBS,我不明白为什么。

<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>

1 个答案:

答案 0 :(得分:0)

我很抱歉我发布了这个问题,但我刚刚找到了一个解决方案,尽管它看起来很奇怪,所以我非常感谢任何改进,这就是为什么我不会直接标记这个答案。

原始教程使用目标文件夹的原因似乎是因为它是临时的,因此在那里部署工件以便在maven clean上删除它是有意义的。

因此,必要的设置是:

<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>

它解决了问题,这就是我发布答案的原因,虽然它并不完美,因为我真的不明白为什么我需要发布管理条目。它现在似乎没有改变该文件夹中的任何内容,但是如果我删除它,则构建不再起作用。

<distributionManagement>
    <repository>
        <id>mvn.public.release</id>
        <url>file://E:/Eigene Dokumente/Repositories/mvn/mvn.public/${project.artifactId}</url>
    </repository>
</distributionManagement>