git clone https://github.com/spring-guides/gs-rest-service.git cd gs-rest-service/complete mvn clean package
[INFO] Installing /home/gk/PerbenMvnRelease/gs-rest-service/complete/target/gs-rest-service-0.1.0.jar to /home/gk/.m2/repository/org/springframework/gs-rest-service/0.1.0/gs-rest-service-0.1.0.jar
[INFO] Installing /home/gk/PerbenMvnRelease/gs-rest-service/complete/pom.xml to /home/gk/.m2/repository/org/springframework/gs-rest-service/0.1.0/gs-rest-service-0.1.0.pom
-
clone
docker pull gitea/gitea:latest
-
buat file docker compose gitea.yml
version: "2"
networks:
gitea:
external: false
services:
gitea:
image: gitea/gitea:latest
environment:
- USER_UID=1000
- USER_GID=1000
restart: always
networks:
- gitea
volumes:
- ./gitea:/data
ports:
- "3000:3000"
- "222:22"
- Jalankan
docker-compose -f gitea.yml up -d
- Siapkan gitea awal-awal, browse ke http://localhost:3000/install
- Register di web dengan user: gitea email: [email protected]
- Buat repo dengan nama gs-rest-service-complete di gitea dan
cp -a gs-rest-service/complete gs-rest-service-complete
cd gs-rest-service-complete
git init
git add .
git commit -m "initial"
git status
git remote add origin http://localhost:3000/gitea/gs-rest-service-complete.git
# git remote show origin
# git remote -v
# git remote set-url origin http://localhost:3000/gitea/gs-rest-service.git
git push -u origin master
- Pull image
docker pull sonatype/nexus3
- buat file docker compose nexus.yml
version: "2"
networks:
nexus:
external: false
services:
nexus:
image: sonatype/nexus3:latest
restart: always
networks:
- nexus
volumes:
- ./nexus-data:/sonatype-work
ports:
- "8081:8081"
- Jalankan
docker-compose -f nexus.yml up -d
, lama startupnya - Debugging dengan
docker-compose -f nexus.yml ps
dandocker-compose -f nexus.yml logs -f
- Buka halaman http://localhost:8081/ , password default u:admin p:admin123
- tambahkan pom.xml
<distributionManagement>
<snapshotRepository>
<id>nexus-snapshots</id>
<url>http://localhost:8081/nexus/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>nexus-releases</id>
<url>http://localhost:8081/repository/maven-releases/</url>
</repository>
</distributionManagement>
- buat atau edit
~/.m2/settings.xml
- Untuk mendeploy ke snapshot ubah pom.xml bagian
<version>0.1.0-SNAPSHOT</version>
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd">
<servers>
<server>
<id>nexus-snapshots</id>
<username>admin</username>
<password>admin123</password>
</server>
<server>
<id>nexus-releases</id>
<username>admin</username>
<password>admin123</password>
</server>
</servers>
</settings>
- buat berkas .gitignore
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
.mvn/wrapper/maven-wrapper.jar
- pastikan di working dir tidak ada kondisi unstaged dan staged cek via
git status
. kondisi bisa di diselesaikan dengan melakukan commitgit add . && git commit -m "Contoh commit"
- tambahkan di pom.xml konfigurasi git
<properties>
...
<project.scm.id>gitea</project.scm.id>
</properties>
...
<scm>
<connection>scm:git:http://localhost:3000/gitea/gs-rest-service-complete.git</connection>
<url>http://localhost:3000/gitea/gs-rest-service-complete</url>
<developerConnection>scm:git:http://localhost:3000/gitea/gs-rest-service-complete.git</developerConnection>
</scm>
- tambahkan di settings.xml otentikasi git
<server>
<id>gitea</id>
<username>gitea</username>
<password>R@has14iz3</password>
</server>
- Jalankan
mvn release:clean release:prepare release:perform -DreleaseVersion=0.1.0 -DdevelopmentVersion=0.1.0-SNAPSHOT
- Cek history commit, tag di git server
- Lihat artifak di nexus
- https://spring.io/guides/gs/rest-service/
- https://www.baeldung.com/install-local-jar-with-maven/
- https://www.baeldung.com/maven-deploy-nexus
- http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html
- http://codeheaven.io/using-nexus-3-as-your-repository-part-1-maven-artifacts/
- https://www.baeldung.com/maven-release-nexus
- gitignore untuk maven https://github.com/github/gitignore/blob/master/Maven.gitignore