Skip to content

Commit

Permalink
Fix build.xml to upload the nbm to the Maven Central
Browse files Browse the repository at this point in the history
  • Loading branch information
junichi11 committed Mar 8, 2023
1 parent 99be1eb commit dc79a5d
Show file tree
Hide file tree
Showing 3 changed files with 141 additions and 2 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
/nbproject/private/
/build/
/build/
lib
pom.xml.asc
42 changes: 41 additions & 1 deletion build.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="netbeans" name="contrib/linetools">
<project basedir="." default="netbeans" name="org.netbeans.modules.linetools" xmlns:artifact="antlib:org.apache.maven.artifact.ant">
<description>Builds, tests, and runs the project org.netbeans.modules.linetools</description>
<import file="nbproject/build-impl.xml"/>
<path id="maven-ant-tasks.classpath" path="lib/maven-ant-tasks-2.1.3.jar" />
<typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="antlib:org.apache.maven.artifact.ant" classpathref="maven-ant-tasks.classpath" />

<!-- define Maven coordinates -->
<property name="build" value="build" />
<property name="groupId" value="com.junichi11.netbeans.modules" />
<property name="artifactId" value="netbeans-sort-line-tools" />
<!-- also change the version of pom.xml -->
<property name="version" value="1.24" />
<!-- defined maven snapshots and staging repository id and url -->
<property name="ossrh-snapshots-repository-url"
value="https://oss.sonatype.org/content/repositories/snapshots/" />
<property name="ossrh-staging-repository-url"
value="https://oss.sonatype.org/service/local/staging/deploy/maven2/" />
<!-- there server id in the Maven settings.xml -->
<property name="ossrh-server-id" value="ossrh" />
<property name="code-name-base" value="org-netbeans-modules-linetools" />

<target name="update-version-number">
<replaceregexp file="pom.xml"
match="(^ &lt;version&gt;).+(&lt;/version&gt;)"
replace="\1${version}\2"
byline="true" />
<replaceregexp file="manifest.mf"
match="(OpenIDE-Module-Specification-Version:[ ]*).+"
replace="\1${version}"
byline="true" />
</target>

<target name="deploy" depends="nbm" description="deploy release version to Maven repository">
<move file="${build}/${code-name-base}.nbm" toFile="${build}/${artifactId}-${version}.nbm"/>
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
<arg value="-Durl=${ossrh-staging-repository-url}" />
<arg value="-DrepositoryId=${ossrh-server-id}" />
<arg value="-DpomFile=pom.xml" />
<arg value="-Dfile=${build}/${artifactId}-${version}.nbm" />
<arg value="-Pgpg" />
</artifact:mvn>
</target>
</project>
97 changes: 97 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
<?xml version="1.0" encoding="UTF-8"?>
<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>com.junichi11.netbeans.modules</groupId>
<artifactId>netbeans-sort-line-tools</artifactId>
<!-- change the version of build.xml -->
<version>1.24</version>
<packaging>nbm</packaging>
<name>NetBeans Sort Line Tools</name>
<url>https://github.com/netbeanslab/nb-sort-line-tools</url>
<description>NetBeans plugin which adds a toolbar with texteditor operations for sorting.</description>
<developers>
<developer>
<id>junichi11</id>
<name>Junichi Yamamoto</name>
<url>https://github.com/junichi11</url>
</developer>
</developers>
<scm>
<connection>scm:git:https://github.com/netbeanslab/nb-sort-line-tools.git</connection>
<developerConnection>scm:git:https://github.com/netbeanslab/nb-sort-line-tools.git</developerConnection>
<url>https://github.com/netbeanslab/nb-sort-line-tools</url>
<tag>HEAD</tag>
</scm>
<licenses>
<license>
<name>Common Development and Distribution License (CDDL) v1.0 and GNU General Public License (GPL) v2</name>
<url>http://netbeans.org/cddl-gplv2.html</url>
</license>
</licenses>
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.0.0-M1</version>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.7</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.2</version>
<configuration>
<archive>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
</dependencies>
</project>

0 comments on commit dc79a5d

Please sign in to comment.