Skip to content

Commit

Permalink
default Nexus endpoint for V.3
Browse files Browse the repository at this point in the history
  • Loading branch information
incu6us committed Jan 21, 2019
1 parent a0d5382 commit ea98ed3
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 4 deletions.
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ FROM alpine:3.8

# Nexus settings
ENV SERVER_URL http://172.17.0.2:8081
ENV RELEASE_ENDPOINT /repository/maven-releases
ENV SNAPSHOT_ENDPOINT /repository/maven-snapshots
ENV USERNAME admin
ENV PASSWORD admin123

Expand Down
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@ GROUP_ID ?= com.egt
ARTIFACT_ID ?= proto-lib
VERSION ?= 0.0.1

# Server configuration
# Nexus configuration
SERVER_URL ?= http://nexus:8081/
# for old versions:
# /nexus/content/repositories/releases
# /nexus/content/repositories/snapshots
RELEASE_ENDPOINT ?= /repository/maven-releases
SNAPSHOT_ENDPOINT ?= /repository/maven-snapshots

# Maven settings
SETTINGS := ./settings.xml
Expand All @@ -17,4 +22,4 @@ build:
cp ./target/*.jar ./proto/build/java/

deploy:
./mvnw -DserverUrl=${SERVER_URL} -DgroupId=${GROUP_ID} -DartifactId=${ARTIFACT_ID} -Dversion=${VERSION} --settings ${SETTINGS} deploy
./mvnw -DserverUrl=${SERVER_URL} -DreleaseEndpoint=${RELEASE_ENDPOINT} -DsnapshotEndpoint=${SNAPSHOT_ENDPOINT} -DgroupId=${GROUP_ID} -DartifactId=${ARTIFACT_ID} -Dversion=${VERSION} --settings ${SETTINGS} deploy
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,20 @@ docker run --rm \
egtukraine/protobuf-generator
```

There are two additional options to set endpoints for release & snapshots for Nexus(by default they are equal to paths for Nexus v.3):
* RELEASE_ENDPOINT
* SNAPSHOT_ENDPOINT

To change them to the lower version you could change it. Ex:
```
docker run --rm \
...
-e RELEASE_ENDPOINT=/nexus/content/repositories/releases
-e SNAPSHOT_ENDPOINT=/nexus/content/repositories/snapshots
...
egtukraine/protobuf-generator
```

To play with this you could run the [Nexus Docker Image](https://hub.docker.com/r/sonatype/nexus/) and start it locally.

Makefile has two options:
Expand Down
6 changes: 4 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,20 @@
<protobuf.plugin.version>0.6.1</protobuf.plugin.version>
<protobuf.version>3.6.1</protobuf.version>
<serverUrl>http://localhost:8081/</serverUrl>
<releaseEndpoint>/repository/maven-releases</releaseEndpoint>
<snapshotEndpoint>/repository/maven-snapshots</snapshotEndpoint>
</properties>

<distributionManagement>
<repository>
<id>localRepo</id>
<uniqueVersion>true</uniqueVersion>
<url>${serverUrl}/nexus/content/repositories/releases</url>
<url>${serverUrl}${releaseEndpoint}</url>
</repository>
<snapshotRepository>
<uniqueVersion>false</uniqueVersion>
<id>localRepo</id>
<url>${serverUrl}/nexus/content/repositories/snapshots</url>
<url>${serverUrl}${snapshotEndpoint}</url>
</snapshotRepository>
</distributionManagement>

Expand Down

0 comments on commit ea98ed3

Please sign in to comment.