首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在github上创建maven存储库

在github上创建maven存储库
EN

Stack Overflow用户
提问于 2021-05-18 11:26:53
回答 1查看 281关注 0票数 0

尝试在github上创建自己的maven repo,以便在其他maven项目中导入我的java lybrary。但创建blob: Not的异常错误(404)。有人能帮忙解决这个问题吗?

当我尝试"mvn清理部署“时:

代码语言:javascript
复制
[ERROR] Failed to execute goal com.github.github:site-maven-plugin:0.12:site (default) on project mavenRepoTest: Error creating blob: Not Found (404) -> [Help 1]

我的pom.xml

代码语言:javascript
复制
    <modelVersion>4.0.0</modelVersion>
    <groupId>org.example</groupId>
    <artifactId>mavenRepoTest</artifactId>
    <version>1.0-SNAPSHOT</version>

    <distributionManagement>
        <repository>
            <id>internal.repo</id>
            <name>Temporary Staging Repository</name>
            <url>file://${project.build.directory}/mvn-repo</url>
        </repository>
    </distributionManagement>
    <build>
        <plugins>
            <plugin>
                <artifactId>maven-deploy-plugin</artifactId>
                <version>2.8.2</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.12</version>
                <configuration>
                    <message>Maven artifacts for ${project.version}</message>
                    <noJekyll>true</noJekyll>
                    <outputDirectory>${project.build.directory}/mvn-repo</outputDirectory>
                    <branch>refs/heads/mvn-repo</branch>
                    <merge>true</merge>
                    <includes>
                        <include>**/*</include>
                    </includes>
                    <repositoryName>https://github.com/Dilitand1/mavenRepoTest</repositoryName>
                    <repositoryOwner>Dilitand1</repositoryOwner>
                    <server>github</server>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>site</goal>
                        </goals>
                        <phase>deploy</phase>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-05-18 11:41:54

当将Github的站点插件用于maven时,repositoryName必须仅作为存储库的名称,在本例中为mavenRepoTest

将服务器添加到maven属性,如下所示:

代码语言:javascript
复制
<properties>
  <github.global.server>github</github.global.server>
</properties>

还请确保maven可以访问GitHub凭据/OAuth2-令牌,例如将它们放入.m2/settings.xml

代码语言:javascript
复制
<settings>
  <servers>
    <server>
      <id>github</id>
      <password>your-oauth-token-here</password>
    </server>
  </servers>
</settings>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67585258

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档