Skip to content

Commit b5d49a2

Browse files
committed
Initial commit
0 parents  commit b5d49a2

12 files changed

Lines changed: 958 additions & 0 deletions

File tree

.github/dependabot.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "maven"
4+
directory: "/"
5+
target-branch: "develop"
6+
open-pull-requests-limit: 10
7+
schedule:
8+
interval: "daily"
9+
time: "09:00"
10+
timezone: "Europe/Berlin"
11+
assignees:
12+
- "thenilsdev"
13+
reviewers:
14+
- "thenilsdev"
15+
- package-ecosystem: "github-actions"
16+
directory: "/"
17+
target-branch: "develop"
18+
open-pull-requests-limit: 10
19+
schedule:
20+
interval: "daily"
21+
time: "09:00"
22+
timezone: "Europe/Berlin"
23+
assignees:
24+
- "thenilsdev"
25+
reviewers:
26+
- "thenilsdev"

.github/workflows/build.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Build CI
2+
3+
on: [ push ]
4+
5+
jobs:
6+
build:
7+
name: Build CI JDK ${{ matrix.java }}
8+
runs-on: ubuntu-latest
9+
if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')"
10+
strategy:
11+
matrix:
12+
java: [ "8", "16" ]
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v2
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Set up JDK ${{ matrix.java }}
20+
uses: actions/setup-java@v2
21+
with:
22+
java-version: ${{ matrix.java }}
23+
distribution: "adopt"
24+
25+
- name: Cache local Maven repository
26+
uses: actions/cache@v2
27+
with:
28+
path: ~/.m2/repository
29+
key: ${{ runner.os }}-maven-build-${{ matrix.java }}-${{ hashFiles('**/pom.xml') }}
30+
restore-keys: ${{ runner.os }}-maven-
31+
32+
- name: Build with Maven
33+
run: mvn -B --update-snapshots package

.github/workflows/release.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Release CI
2+
3+
on:
4+
push:
5+
branches:
6+
- "main"
7+
8+
jobs:
9+
build:
10+
name: Release CI
11+
runs-on: ubuntu-latest
12+
if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')"
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v2
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Set up JDK 8
20+
uses: actions/setup-java@v2
21+
with:
22+
java-version: 8
23+
distribution: "adopt"
24+
25+
- name: Cache local Maven repository
26+
uses: actions/cache@v2
27+
with:
28+
path: ~/.m2/repository
29+
key: ${{ runner.os }}-maven-release-${{ hashFiles('**/pom.xml') }}
30+
restore-keys: ${{ runner.os }}-maven-
31+
32+
# semantic-release:release will fail, when no release required
33+
- name: Release with Maven
34+
run: mvn -B semantic-release:release
35+
id: release
36+
continue-on-error: true
37+
38+
- name: Sync develop
39+
run: |
40+
git checkout develop
41+
git merge main
42+
git push
43+
if: steps.release.outcome == 'success' && steps.release.conclusion == 'success'
44+
continue-on-error: true
45+
46+
- name: Switch back to main
47+
run: git checkout main
48+
if: steps.release.outcome == 'success' && steps.release.conclusion == 'success'
49+
continue-on-error: true
50+
51+
- name: Get current tag
52+
id: current_tag
53+
run: echo ::set-output name=tag::$(git describe --abbrev=0 --tags)
54+
if: steps.release.outcome == 'success' && steps.release.conclusion == 'success'
55+
56+
- name: Get Git Changelog
57+
id: get_changelog
58+
uses: thenilsdev/git-log-action@1.0.5
59+
if: steps.release.outcome == 'success' && steps.release.conclusion == 'success'
60+
61+
- name: Build with Maven
62+
run: mvn -B package
63+
if: steps.release.outcome == 'success' && steps.release.conclusion == 'success'
64+
65+
# deploy to some repo, if needed
66+
67+
- name: Create Release
68+
uses: softprops/action-gh-release@v1
69+
id: create_release
70+
with:
71+
tag_name: ${{ steps.current_tag.outputs.tag }}
72+
name: Release ${{ steps.current_tag.outputs.tag }}
73+
body: ${{ steps.get_changelog.outputs.log }}
74+
files: ./artifacts/*.jar
75+
env:
76+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
77+
if: steps.release.outcome == 'success' && steps.release.conclusion == 'success'

.gitignore

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
2+
# Created by https://www.toptal.com/developers/gitignore/api/git,maven,intellij+all
3+
# Edit at https://www.toptal.com/developers/gitignore?templates=git,maven,intellij+all
4+
5+
### Git ###
6+
# Created by git for backups. To disable backups in Git:
7+
# $ git config --global mergetool.keepBackup false
8+
*.orig
9+
10+
# Created by git when using merge tools for conflicts
11+
*.BACKUP.*
12+
*.BASE.*
13+
*.LOCAL.*
14+
*.REMOTE.*
15+
*_BACKUP_*.txt
16+
*_BASE_*.txt
17+
*_LOCAL_*.txt
18+
*_REMOTE_*.txt
19+
20+
### Intellij+all ###
21+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
22+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
23+
24+
# User-specific stuff
25+
.idea/**/workspace.xml
26+
.idea/**/tasks.xml
27+
.idea/**/usage.statistics.xml
28+
.idea/**/dictionaries
29+
.idea/**/shelf
30+
31+
# Generated files
32+
.idea/**/contentModel.xml
33+
34+
# Sensitive or high-churn files
35+
.idea/**/dataSources/
36+
.idea/**/dataSources.ids
37+
.idea/**/dataSources.local.xml
38+
.idea/**/sqlDataSources.xml
39+
.idea/**/dynamic.xml
40+
.idea/**/uiDesigner.xml
41+
.idea/**/dbnavigator.xml
42+
43+
# Gradle
44+
.idea/**/gradle.xml
45+
.idea/**/libraries
46+
47+
# Gradle and Maven with auto-import
48+
# When using Gradle or Maven with auto-import, you should exclude module files,
49+
# since they will be recreated, and may cause churn. Uncomment if using
50+
# auto-import.
51+
# .idea/artifacts
52+
# .idea/compiler.xml
53+
# .idea/jarRepositories.xml
54+
# .idea/modules.xml
55+
# .idea/*.iml
56+
# .idea/modules
57+
# *.iml
58+
# *.ipr
59+
60+
# CMake
61+
cmake-build-*/
62+
63+
# Mongo Explorer plugin
64+
.idea/**/mongoSettings.xml
65+
66+
# File-based project format
67+
*.iws
68+
69+
# IntelliJ
70+
out/
71+
72+
# mpeltonen/sbt-idea plugin
73+
.idea_modules/
74+
75+
# JIRA plugin
76+
atlassian-ide-plugin.xml
77+
78+
# Cursive Clojure plugin
79+
.idea/replstate.xml
80+
81+
# Crashlytics plugin (for Android Studio and IntelliJ)
82+
com_crashlytics_export_strings.xml
83+
crashlytics.properties
84+
crashlytics-build.properties
85+
fabric.properties
86+
87+
# Editor-based Rest Client
88+
.idea/httpRequests
89+
90+
# Android studio 3.1+ serialized cache file
91+
.idea/caches/build_file_checksums.ser
92+
93+
### Intellij+all Patch ###
94+
# Ignores the whole .idea folder and all .iml files
95+
# See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360
96+
97+
.idea/
98+
99+
# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023
100+
101+
*.iml
102+
modules.xml
103+
.idea/misc.xml
104+
*.ipr
105+
106+
# Sonarlint plugin
107+
.idea/sonarlint
108+
109+
### Maven ###
110+
target/
111+
pom.xml.tag
112+
pom.xml.releaseBackup
113+
pom.xml.versionsBackup
114+
pom.xml.next
115+
release.properties
116+
dependency-reduced-pom.xml
117+
buildNumber.properties
118+
.mvn/timing.properties
119+
# https://github.com/takari/maven-wrapper#usage-without-binary-jar
120+
.mvn/wrapper/maven-wrapper.jar
121+
122+
# End of https://www.toptal.com/developers/gitignore/api/git,maven,intellij+all
123+
124+
artifacts/

.mvn/extensions.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<extensions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/EXTENSIONS/1.0.0"
2+
xsi:schemaLocation="http://maven.apache.org/EXTENSIONS/1.0.0 http://maven.apache.org/xsd/core-extensions-1.0.0.xsd">
3+
<extension>
4+
<groupId>gg.nils</groupId>
5+
<artifactId>semantic-release-maven-plugin</artifactId>
6+
<version>1.1.9</version>
7+
</extension>
8+
</extensions>
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
/*
2+
* Copyright 2007-present the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
import java.net.*;
17+
import java.io.*;
18+
import java.nio.channels.*;
19+
import java.util.Properties;
20+
21+
public class MavenWrapperDownloader {
22+
23+
private static final String WRAPPER_VERSION = "0.5.6";
24+
/**
25+
* Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
26+
*/
27+
private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
28+
+ WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
29+
30+
/**
31+
* Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
32+
* use instead of the default one.
33+
*/
34+
private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
35+
".mvn/wrapper/maven-wrapper.properties";
36+
37+
/**
38+
* Path where the maven-wrapper.jar will be saved to.
39+
*/
40+
private static final String MAVEN_WRAPPER_JAR_PATH =
41+
".mvn/wrapper/maven-wrapper.jar";
42+
43+
/**
44+
* Name of the property which should be used to override the default download url for the wrapper.
45+
*/
46+
private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
47+
48+
public static void main(String args[]) {
49+
System.out.println("- Downloader started");
50+
File baseDirectory = new File(args[0]);
51+
System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
52+
53+
// If the maven-wrapper.properties exists, read it and check if it contains a custom
54+
// wrapperUrl parameter.
55+
File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
56+
String url = DEFAULT_DOWNLOAD_URL;
57+
if(mavenWrapperPropertyFile.exists()) {
58+
FileInputStream mavenWrapperPropertyFileInputStream = null;
59+
try {
60+
mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
61+
Properties mavenWrapperProperties = new Properties();
62+
mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
63+
url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
64+
} catch (IOException e) {
65+
System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
66+
} finally {
67+
try {
68+
if(mavenWrapperPropertyFileInputStream != null) {
69+
mavenWrapperPropertyFileInputStream.close();
70+
}
71+
} catch (IOException e) {
72+
// Ignore ...
73+
}
74+
}
75+
}
76+
System.out.println("- Downloading from: " + url);
77+
78+
File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
79+
if(!outputFile.getParentFile().exists()) {
80+
if(!outputFile.getParentFile().mkdirs()) {
81+
System.out.println(
82+
"- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
83+
}
84+
}
85+
System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
86+
try {
87+
downloadFileFromURL(url, outputFile);
88+
System.out.println("Done");
89+
System.exit(0);
90+
} catch (Throwable e) {
91+
System.out.println("- Error downloading");
92+
e.printStackTrace();
93+
System.exit(1);
94+
}
95+
}
96+
97+
private static void downloadFileFromURL(String urlString, File destination) throws Exception {
98+
if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
99+
String username = System.getenv("MVNW_USERNAME");
100+
char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
101+
Authenticator.setDefault(new Authenticator() {
102+
@Override
103+
protected PasswordAuthentication getPasswordAuthentication() {
104+
return new PasswordAuthentication(username, password);
105+
}
106+
});
107+
}
108+
URL website = new URL(urlString);
109+
ReadableByteChannel rbc;
110+
rbc = Channels.newChannel(website.openStream());
111+
FileOutputStream fos = new FileOutputStream(destination);
112+
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
113+
fos.close();
114+
rbc.close();
115+
}
116+
117+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip
2+
wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar

0 commit comments

Comments
 (0)