【发布时间】:2014-09-06 10:21:30
【问题描述】:
我有一个 Java 库,它的构建过程完全用 Ant 编写。项目的沙箱(源码目录,我在里面编辑代码)是
R:\jeffy\programming\sandbox\xbnjava\
它的构建(输出)目录是
R:\jeffy\programming\build\xbnjava-0.1.1\
这就是我的目标:
-
ant cleanpublish:从头开始构建项目,包括创建这三个jarmylibrary-0.1.1.jarmylibrary-0.1.1-sources.jarmylibrary-0.1.1-javadoc.jar
放入
R:\jeffy\programming\build\xbnjava-0.1.1\download这部分已经完成并且运行良好。这三个罐子是 Maven Central 的 as required(向上滚动一点点查看)。
在 GitHub 中检查版本并将构建目录上传到我的 Web 服务器。这一步我也完成了。
mvn deploy:唯一需要做的就是签署三个 jar 并将它们推送到 Maven Central。这是我目前存在的祸根。
这些是我到目前为止所采取的步骤:我已经
- Set up my project 在 sonatype,
- Created my public key 和 gpg4win(related documentation 在 sonatype 上)
- Downloaded 和 installed Maven
-
设置我希望是correct
settings.xml:<?xml version="1.0" encoding="UTF-8"?> <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> <servers> <server> <id>sonatype-nexus-snapshots</id> <username>MY_SONATYPE_USERNAME</username> <password>MY_SONATYPE_PASSWORD</password> </server> <server> <id>sonatype-nexus-staging</id> <username>MY_SONATYPE_USERNAME</username> <password>MY_SONATYPE_PASSWORD</password> </server> </servers> <pluginGroups></pluginGroups> <proxies></proxies> <mirrors></mirrors> <profiles></profiles> </settings>
(此文件存储在R:\jeffy\programming\sandbox\settings.xml,因为它被我的每个项目使用。)
- 至少设置我的
pom.xml的开头,基于the one inez-vcard(参考the author's 有帮助的blog post)。我还使用了 Maven 的 introduction to the POM 作为指导。
这些部分,在上面,我相信我明白了:
<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>
<groupId>com.github.xbn</groupId>
<artifactId>xbnjava</artifactId>
<packaging>jar</packaging>
<version>0.1.2-SNAPSHOT</version>
<name>XBN-Java</name>
<url>https://github.com/aliteralmind/xbnjava</url>
<inceptionYear>2014</inceptionYear>
<organization>
<name>Jeff Epstein</name>
</organization>
<description>XBN-Java is a collection of generically-useful backend (server side, non-GUI) programming utilities, featuring RegexReplacer and FilteredLineIterator. XBN-Java is the foundation of Codelet (http://codelet.aliteralmind.com).</description>
<parent>
<groupId>org.sonatype.oss</groupId>
<artifactId>oss-parent</artifactId>
<version>7</version>
</parent>
<licenses>
<license>
<name>Lesser General Public License (LGPL) version 3.0</name>
<url>https://www.gnu.org/licenses/lgpl-3.0.txt</url>
</license>
<license>
<name>Apache Software License (ASL) version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
</license>
</licenses>
<developers>
<developer>
<name>Jeff Epstein</name>
<email>aliteralmind-github@yahoo.com</email>
<roles>
<role>Lead Developer</role>
</roles>
</developer>
</developers>
<issueManagement>
<system>GitHub Issue Tracker</system>
<url>https://github.com/aliteralmind/xbnjava/issues</url>
</issueManagement>
<scm>
<connection>scm:git:git@github.com:aliteralmind/xbnjava.git</connection>
<url>scm:git:git@github.com:aliteralmind/xbnjava.git</url>
<developerConnection>scm:git:git@github.com:aliteralmind/xbnjava.git</developerConnection>
</scm>
<properties>
<java.version>1.7</java.version>
</properties>
其余的,我不太确定:
<profiles>
<!--
This profile will sign the JAR file, sources file, and javadocs file using the GPG key on the local machine.
See: https://docs.sonatype.org/display/Repository/How+To+Generate+PGP+Signatures+With+Maven
-->
<profile>
<id>release-sign-artifacts</id>
<activation>
<property>
<name>release</name>
<value>true</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>package</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
我需要做什么才能完成POM,它的路径是
R:\jeffy\programming\sandbox\xbnjava\pom.xml
所以它签名并推送这三个 jar 文件,位于
R:\jeffy\programming\build\xbnjava-0.1.1\download\
到 Maven 中心?
我真的很感激一些关于从这里去哪里的建议。我已经在 Maven 文档中游泳了三天,我迷失了和沮丧。这是我在过去几年中使用 Maven 的第三次尝试,但每次都非常糟糕。
(我最初尝试fulfill Maven requirements with Ant tasks,但我决定将我的 Ant 构建和 Maven 签名的罐子和推送到 Maven-Central 部分完全分开。这是为了学习新的东西,但是还因为在 Ant 中实现 Maven 似乎比纯粹的 Maven 更不标准。)
谢谢你帮助我。
【问题讨论】: