Build Maven Central artifacts
Closed this issue · 6 comments
Can I build somehow artifacts for maven central?
Sorry for spamming issues... I just saw your repo to day and I love it.
Of course, look at:
That doesn't tell me how I can release things to maven central. These are currently my steps and plugin for maven central release:
<profiles>
<profile>
<!-- mvn clean deploy -P release -->
<id>release</id>
<activation>
<property>
<name>release</name>
<value>true</value>
</property>
<activeByDefault>false</activeByDefault>
</activation>
<build>
<plugins>
<!-- QUALITY GATE -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${maven-javadoc-plugin.version}</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<nodeprecatedlist>true</nodeprecatedlist>
<quiet>true</quiet>
<!-- disable strict checking -->
<doclint>none</doclint>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>${maven-source-plugin.version}</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>${maven-gpg-plugin.version}</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
<configuration>
<gpgArguments>
<!-- https://maven.apache.org/guides/mini/guide-encryption.html -->
<!-- https://central.sonatype.org/pages/apache-maven.html#distribution-management-and-authentication -->
<arg>--pinentry-mode</arg>
<arg>loopback</arg>
</gpgArguments>
</configuration>
</execution>
</executions>
</plugin>
<!-- DEPLOYMENT -->
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>${nexus-staging-maven-plugin.version}</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-release-plugin</artifactId>
<version>${maven-release-plugin.version}</version>
<configuration>
<autoVersionSubmodules>true</autoVersionSubmodules>
<useReleaseProfile>true</useReleaseProfile>
<releaseProfiles>release</releaseProfiles>
<goals>deploy</goals>
</configuration>
</plugin>
</plugins>
</build>
<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>
</profile>
</profiles>
We also added a publishing section to the wiki:
Hope this helps.
Hm, just as feedback not as complain, i still love your approach and idea! But i cant tell why, it does not feel intuitive to use. At least for me.
Also things like new PublishInfo()
, new PublishLicense()
, new PublishScm()
are breaking the cool chaning flow.
Would be also nice to shorten stuff like githubSCM("https://github.com/johndoe/mylibrary") or read defaults like groupId
License
, repo url
,... from folder structure. Just few whises from my side.
But i still will try it out one time :)
Thanks for feedback.
bld is making extensive use of the standard builder pattern, which sounds like is what you are unfamiliar with. I can relate. It was not a pattern I used regularly, and took a bit to get comfortable with.
The publishing options are following the Maven standard naming conventions, which makes sense since you are publishing to a Maven repository.
You could store all of your default publishing options in a properties file, so that they can be reused between projects, etc.
Don't give up. There's always a learning curve with new tools, and we are here to help.