Skip to content

Commit

Permalink
Merge branch 'dev' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
phip1611 committed Sep 17, 2020
2 parents 9f78cb4 + 15f91c8 commit e25e845
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 5 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@ This means we can't just do a simple replace on a `Text`-object (a Docx4J-Type).
**PS:** This is not yet in maven central. (TODO)

### Usage:

##### pom.xml / Maven
<dependency>
<groupId>de.phip1611</groupId>
<artifactId>docx4j-search-and-replace-util</artifactId>
<version>%latest version%</version>
</dependency>

##### Code
WordprocessingMLPackage template = WordprocessingMLPackage.load(new FileInputStream(new File("document.docx")));;

Expand Down
10 changes: 5 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@

<groupId>de.phip1611</groupId>
<artifactId>docx4j-search-and-replace-util</artifactId>
<version>1.0.1</version>
<version>1.0.2-SNAPSHOT</version>
<name>Docx4J Search and Replace Util</name>
<description>
Docx4JSRUtil library helps you to search and replace text inside docx-Documents parsed by Docx4J.
</description>
<description>Docx4JSRUtil library helps you to search and replace text inside docx-Documents parsed by Docx4J.</description>
<url>https://github.com/phip1611/docx4j-search-and-replace-util</url>

<licenses>
Expand All @@ -31,7 +29,7 @@
<developerConnection>scm:git:https://github.com/phip1611/docx4j-search-and-replace-util.git
</developerConnection>
<url>https://github.com/phip1611/docx4j-search-and-replace-util</url>
<tag>docx4j-search-and-replace-util-1.0.1</tag>
<tag>HEAD</tag>
</scm>

<properties>
Expand Down Expand Up @@ -156,6 +154,8 @@
<pushChanges>false</pushChanges>
<mavenExecutorId>forked-path</mavenExecutorId>
<!-- comes from $HOME/.me/settings.xml -->
<!-- seems to me like this doesn't work because during
'mvn release:perform' gpg asks for the passphrase anyway -->
<arguments>-Dgpg.passphrase=${gpg.passphrase}</arguments>
</configuration>
<dependencies>
Expand Down
65 changes: 65 additions & 0 deletions publish_to_maven_central.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
This is my first project that I publish in Maven central.

## Workflow
Release to maven consists of two steps:
1) artifact is pushed to https://oss.sonatype.org/#nexus-search;quick~phip1611
2) they push it further to maven central

Only snapshot versions can be released!
https://stackoverflow.com/questions/20054185/you-dont-have-a-snapshot-project-in-the-reactor-projects-list-when-using-jen
-> replacement is automatically done during "mvn release:prepare"

Maven doesn't care about branches. Release can be done from "dev" branch.
I think this is also the way to go because the version has to be "x.y.z-SNAPSHOT".
After the release the branch can be merged into master.... or merge to master
first and release then.


---
## Setup

1) (ONCE) I created an account on sonatype.org (they work as distributor into maven central)
https://issues.sonatype.org/browse/OSSRH-60727
2) (PER MACHINE) I added login data in `$HOME/.m2/settings.xml`
```
<settings>
<servers>
<server>
<!-- publishing to maven central-->
<!-- via: https://issues.sonatype.org/browse/OSSRH-60727-->
<id>ossrh</id>
<username>phip1611</username>
<password>****</password>
</server>
</servers>
</settings>
```
3) (ONCE; COPY KEY TO OTHER MACHINES AND ADD IT TO GPG) I created a gpg key on my Mac (don't forget to backup it!) (public ID):
```
pub rsa3072 2020-09-17 [SC]
389BB8340DA168D0
D21DE8C7C1BE873DD10DCB13389BB8340DA168D0
uid Philipp Schuster (Maven Central publishing) <[email protected]>
sub rsa3072 2020-09-17 [E]
```
4) (PER MACHINE) add gpg key to `$HOME/.m2/settings.xml`
```
<profiles>
<profile>
<id>ossrh</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<!-- password for key: D21DE8C7C1BE873DD10DCB13389BB8340DA168D0
on local machine (in gpg keystore) -->
<gpg.passphrase>****</gpg.passphrase>
</properties>
</profile>
</profiles>
```
5) (ONCE) send pgp key to pgp.mit.edu server:
~~gpg --keyserver pgp.mit.edu --send-key 389BB8340DA168D0~~ (didn't worked during `mvn release:perform`)
`gpg --keyserver keys.openpgp.org:11371 --send-key 389BB8340DA168D0`
6) (PER RELEASE) execute `sh release.sh`
8 changes: 8 additions & 0 deletions release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
mvn clean

mvn release:prepare

mvn release:perform

# git push --tags
# git push origin main

0 comments on commit e25e845

Please sign in to comment.