Java 如何向Maven Central提交GitHub项目?

Java 如何向Maven Central提交GitHub项目?,java,eclipse,maven,jar,Java,Eclipse,Maven,Jar,我有一个GWT/Java项目托管在github上。我创建了一个maven项目结构 mvm clean install 我得到我的项目生成的jar文件。我试图将它上传到oss.sonatype.org,但是关闭那里的项目失败了 有没有一种简单的方法将我的jar提交给maven central?我的pom.xml中是否有以下错误? <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2

我有一个GWT/Java项目托管在github上。我创建了一个maven项目结构

mvm clean install
我得到我的项目生成的jar文件。我试图将它上传到oss.sonatype.org,但是关闭那里的项目失败了

有没有一种简单的方法将我的jar提交给maven central?我的pom.xml中是否有以下错误?

<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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <!-- sonatype parent pom -->
    <parent>
        <groupId>org.sonatype.oss</groupId>
        <artifactId>oss-parent</artifactId>
        <version>7</version>
    </parent>


    <groupId>org.example</groupId>
    <artifactId>test</artifactId>
    <version>1.1-SNAPSHOT</version>
    <packaging>jar</packaging>
    <name>Test</name>

    <url>https://github.com/test/test</url>
    <description>A test.js library.</description>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <gwtversion>2.6.0</gwtversion>
    </properties>

    <licenses>
        <license>
            <name>The Apache Software License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>


    <developers>
        <developer>
            <name>Author</name>
            <email>mail@example.com</email>
            <url>http://www.example.de</url>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:git@github.com:test/test.git</connection>
        <developerConnection>scm:git:git@github.com:test/test.git</developerConnection>
        <url>http://github.com/test/test.git</url>
        <tag>HEAD</tag>
    </scm>


    <distributionManagement>
        <snapshotRepository>
            <id>sonatype-nexus-snapshots</id>
            <name>Sonatype Nexus snapshot repository</name>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
        <repository>
            <id>sonatype-nexus-staging</id>
            <name>Sonatype Nexus release repository</name>
            <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
    </distributionManagement>


    <build>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>2.9.1</version>
                <configuration>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>2.2.1</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>jar-no-fork</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-eclipse-plugin</artifactId>
                <version>2.9</version>

                <configuration>
                    <downloadSources>true</downloadSources>
                    <downloadJavadocs>true</downloadJavadocs>
                    <projectnatures>
                        <projectnature>org.eclipse.jdt.core.javanature</projectnature>
                        <nature>com.google.gwt.eclipse.core.gwtNature</nature>
                    </projectnatures>
                    <buildcommands>
                        <buildcommand>org.eclipse.jdt.core.javabuilder</buildcommand>
                        <buildcommand>com.google.appengine.eclipse.core.projectValidator</buildcommand>
                        <buildcommand>com.google.gwt.eclipse.core.gwtProjectValidator</buildcommand>
                    </buildcommands>
                    <classpathContainers>
                        <classpathContainer>org.eclipse.jdt.launching.JRE_CONTAINER</classpathContainer>
                        <classpathContainer>com.google.gwt.eclipse.core.GWT_CONTAINER</classpathContainer>
                    </classpathContainers>
                    <excludes>
                        <exclude>com.google.gwt:gwt-servlet</exclude>
                        <exclude>com.google.gwt:gwt-user</exclude>
                        <exclude>com.google.gwt:gwt-dev</exclude>
                        <exclude>javax.validation:validation-api</exclude>
                    </excludes>


                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>2.5</version>
                <configuration>
                    <arguments>-Dgpg.passphrase=${gpg.passphrase}</arguments>
                </configuration>
            </plugin>



        </plugins>
        <resources>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/client/**</include>
                    <include>**/shared/**</include>
                    <include>**/*.gwt.xml</include>
                </includes>
            </resource>
        </resources>
    </build>


    <profiles>
        <profile>
            <id>release-sign-artifacts</id>
            <activation>
                <property>
                    <name>performRelease</name>
                    <value>true</value>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>1.5</version>
                        <configuration>
                            <passphrase>${gpg.passphrase}</passphrase>
                        </configuration>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>



    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.7</version>
            <type>jar</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.google.gwt</groupId>
            <artifactId>gwt-user</artifactId>
            <version>${gwtversion}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.google.gwt</groupId>
            <artifactId>gwt-dev</artifactId>
            <version>${gwtversion}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
            <version>1.0.0.GA</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
            <version>1.0.0.GA</version>
            <classifier>sources</classifier>
            <scope>provided</scope>
        </dependency>

        <!-- only for File API emulation in hosted mode -->
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.0.1</version>
        </dependency>
    </dependencies>



</project>

4.0.0
org.sonatype.oss
oss父级
7.
org.example
测试
1.1-快照
罐子
试验
https://github.com/test/test
一个test.js库。
UTF-8
2.6.0
Apache软件许可证,版本2.0
http://www.apache.org/licenses/LICENSE-2.0.txt
回购
作者
mail@example.com
http://www.example.de
scm:git:git@github.com:test/test.git
scm:git:git@github.com:test/test.git
http://github.com/test/test.git
头
sonatype nexus快照
Sonatype Nexus快照存储库
https://oss.sonatype.org/content/repositories/snapshots
索纳型连接分期
Sonatype Nexus发布库
https://oss.sonatype.org/service/local/staging/deploy/maven2/
maven编译器插件
3.1
1.6
1.6
org.apache.maven.plugins
maven javadoc插件
2.9.1
org.apache.maven.plugins
maven源插件
2.2.1
附加来源
验证
罐子没有叉子
org.apache.maven.plugins
maven eclipse插件
2.9
真的
真的
org.eclipse.jdt.core.javanature
com.google.gwt.eclipse.core.gwtNature
org.eclipse.jdt.core.javabuilder
com.google.appengine.eclipse.core.projectValidator
com.google.gwt.eclipse.core.gwtProjectValidator
org.eclipse.jdt.launching.JRE_容器
com.google.gwt.eclipse.core.gwt_容器
gwt:gwtservlet
gwt:gwt用户
gwt:gwtdev
验证:验证api
org.apache.maven.plugins
maven发布插件
2.5
-Dgpg.passphrase=${gpg.passphrase}
src/main/java
**/客户/**
**/共享/**
**/*.gwt.xml
释放标志伪影
性能释放酶
真的
org.apache.maven.plugins
maven gpg插件
1.5
${gpg.passphrase}
符号伪影
验证
签名
朱尼特
朱尼特
4.7
罐子
测试
com.google.gwt
gwt用户
${gwtversion}
假如
com.google.gwt
gwt开发
${gwtversion}
假如
javax.validation
验证api
1.0.0.GA
假如
javax.validation
验证api
1.0.0.GA
来源
假如
公地io
公地io
2.0.1
编辑:当我想关闭sonatype上的回购时,我遇到以下错误:


编辑:我解决了JavaDoc问题,但签名问题仍然存在。

您的pom有groupId=org.example和artifactId=test:您必须选择唯一的坐标

最近发表了一篇新的导言

您应该仔细阅读以下要求:

不要忘记,一旦一个工件发布到中心,它将绝对对每个人都可用,并且永远不会被修改/删除。所以不要发布一些测试:在工作足够稳定后发布


您可以使用本地存储库管理器进行学习。

提供了大量的视频教程。在您的情况下,您的工件没有被签名存在问题

您需要严格遵循说明中的每一步。您是否在步骤3中创建了Jira票证?