🎉 Init
This commit is contained in:
commit
3f33baa702
5
.dockerignore
Normal file
5
.dockerignore
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
src
|
||||||
|
!target/*-runner
|
||||||
|
!target/*-runner.jar
|
||||||
|
!target/lib/*
|
||||||
|
!target/quarkus-app/*
|
||||||
45
.gitignore
vendored
Normal file
45
.gitignore
vendored
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
#Maven
|
||||||
|
target/
|
||||||
|
pom.xml.tag
|
||||||
|
pom.xml.releaseBackup
|
||||||
|
pom.xml.versionsBackup
|
||||||
|
release.properties
|
||||||
|
.flattened-pom.xml
|
||||||
|
|
||||||
|
# Eclipse
|
||||||
|
.project
|
||||||
|
.classpath
|
||||||
|
.settings/
|
||||||
|
bin/
|
||||||
|
|
||||||
|
# IntelliJ
|
||||||
|
.idea
|
||||||
|
*.ipr
|
||||||
|
*.iml
|
||||||
|
*.iws
|
||||||
|
|
||||||
|
# NetBeans
|
||||||
|
nb-configuration.xml
|
||||||
|
|
||||||
|
# Visual Studio Code
|
||||||
|
.vscode
|
||||||
|
.factorypath
|
||||||
|
|
||||||
|
# OSX
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
# Vim
|
||||||
|
*.swp
|
||||||
|
*.swo
|
||||||
|
|
||||||
|
# patch
|
||||||
|
*.orig
|
||||||
|
*.rej
|
||||||
|
|
||||||
|
# Local environment
|
||||||
|
.env
|
||||||
|
|
||||||
|
# Plugin directory
|
||||||
|
/.quarkus/cli/plugins/
|
||||||
|
# TLS Certificates
|
||||||
|
.certs/
|
||||||
3
.mvn/wrapper/maven-wrapper.properties
vendored
Normal file
3
.mvn/wrapper/maven-wrapper.properties
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
wrapperVersion=3.3.4
|
||||||
|
distributionType=only-script
|
||||||
|
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.12/apache-maven-3.9.12-bin.zip
|
||||||
76
README.md
Normal file
76
README.md
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
# core
|
||||||
|
|
||||||
|
This project uses Quarkus, the Supersonic Subatomic Java Framework.
|
||||||
|
|
||||||
|
If you want to learn more about Quarkus, please visit its website: <https://quarkus.io/>.
|
||||||
|
|
||||||
|
## Running the application in dev mode
|
||||||
|
|
||||||
|
You can run your application in dev mode that enables live coding using:
|
||||||
|
|
||||||
|
```shell script
|
||||||
|
./mvnw quarkus:dev
|
||||||
|
```
|
||||||
|
|
||||||
|
> **_NOTE:_** Quarkus now ships with a Dev UI, which is available in dev mode only at <http://localhost:8080/q/dev/>.
|
||||||
|
|
||||||
|
## Packaging and running the application
|
||||||
|
|
||||||
|
The application can be packaged using:
|
||||||
|
|
||||||
|
```shell script
|
||||||
|
./mvnw package
|
||||||
|
```
|
||||||
|
|
||||||
|
It produces the `quarkus-run.jar` file in the `target/quarkus-app/` directory.
|
||||||
|
Be aware that it’s not an _über-jar_ as the dependencies are copied into the `target/quarkus-app/lib/` directory.
|
||||||
|
|
||||||
|
The application is now runnable using `java -jar target/quarkus-app/quarkus-run.jar`.
|
||||||
|
|
||||||
|
If you want to build an _über-jar_, execute the following command:
|
||||||
|
|
||||||
|
```shell script
|
||||||
|
./mvnw package -Dquarkus.package.jar.type=uber-jar
|
||||||
|
```
|
||||||
|
|
||||||
|
The application, packaged as an _über-jar_, is now runnable using `java -jar target/*-runner.jar`.
|
||||||
|
|
||||||
|
## Creating a native executable
|
||||||
|
|
||||||
|
You can create a native executable using:
|
||||||
|
|
||||||
|
```shell script
|
||||||
|
./mvnw package -Dnative
|
||||||
|
```
|
||||||
|
|
||||||
|
Or, if you don't have GraalVM installed, you can run the native executable build in a container using:
|
||||||
|
|
||||||
|
```shell script
|
||||||
|
./mvnw package -Dnative -Dquarkus.native.container-build=true
|
||||||
|
```
|
||||||
|
|
||||||
|
You can then execute your native executable with: `./target/core-1.0.0-SNAPSHOT-runner`
|
||||||
|
|
||||||
|
If you want to learn more about building native executables, please consult <https://quarkus.io/guides/maven-tooling>.
|
||||||
|
|
||||||
|
## Related Guides
|
||||||
|
|
||||||
|
- REST resources for Hibernate ORM with Panache ([guide](https://quarkus.io/guides/rest-data-panache)): Generate Jakarta REST resources for your Hibernate Panache entities and repositories
|
||||||
|
- REST ([guide](https://quarkus.io/guides/rest)): A Jakarta REST implementation utilizing build time processing and Vert.x. This extension is not compatible with the quarkus-resteasy extension, or any of the extensions that depend on it.
|
||||||
|
- REST Jackson ([guide](https://quarkus.io/guides/rest#json-serialisation)): Jackson serialization support for Quarkus REST. This extension is not compatible with the quarkus-resteasy extension, or any of the extensions that depend on it
|
||||||
|
- JDBC Driver - PostgreSQL ([guide](https://quarkus.io/guides/datasource)): Connect to the PostgreSQL database via JDBC
|
||||||
|
|
||||||
|
## Provided Code
|
||||||
|
|
||||||
|
### REST Data with Panache
|
||||||
|
|
||||||
|
Generating Jakarta REST resources with Panache
|
||||||
|
|
||||||
|
[Related guide section...](https://quarkus.io/guides/rest-data-panache)
|
||||||
|
|
||||||
|
|
||||||
|
### REST
|
||||||
|
|
||||||
|
Easily start your REST Web Services
|
||||||
|
|
||||||
|
[Related guide section...](https://quarkus.io/guides/getting-started-reactive#reactive-jax-rs-resources)
|
||||||
295
mvnw
vendored
Executable file
295
mvnw
vendored
Executable file
@ -0,0 +1,295 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
# Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
# or more contributor license agreements. See the NOTICE file
|
||||||
|
# distributed with this work for additional information
|
||||||
|
# regarding copyright ownership. The ASF licenses this file
|
||||||
|
# to you under the Apache License, Version 2.0 (the
|
||||||
|
# "License"); you may not use this file except in compliance
|
||||||
|
# with the License. You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing,
|
||||||
|
# software distributed under the License is distributed on an
|
||||||
|
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
# KIND, either express or implied. See the License for the
|
||||||
|
# specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
# Apache Maven Wrapper startup batch script, version 3.3.4
|
||||||
|
#
|
||||||
|
# Optional ENV vars
|
||||||
|
# -----------------
|
||||||
|
# JAVA_HOME - location of a JDK home dir, required when download maven via java source
|
||||||
|
# MVNW_REPOURL - repo url base for downloading maven distribution
|
||||||
|
# MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven
|
||||||
|
# MVNW_VERBOSE - true: enable verbose log; debug: trace the mvnw script; others: silence the output
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
set -euf
|
||||||
|
[ "${MVNW_VERBOSE-}" != debug ] || set -x
|
||||||
|
|
||||||
|
# OS specific support.
|
||||||
|
native_path() { printf %s\\n "$1"; }
|
||||||
|
case "$(uname)" in
|
||||||
|
CYGWIN* | MINGW*)
|
||||||
|
[ -z "${JAVA_HOME-}" ] || JAVA_HOME="$(cygpath --unix "$JAVA_HOME")"
|
||||||
|
native_path() { cygpath --path --windows "$1"; }
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# set JAVACMD and JAVACCMD
|
||||||
|
set_java_home() {
|
||||||
|
# For Cygwin and MinGW, ensure paths are in Unix format before anything is touched
|
||||||
|
if [ -n "${JAVA_HOME-}" ]; then
|
||||||
|
if [ -x "$JAVA_HOME/jre/sh/java" ]; then
|
||||||
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
|
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||||
|
JAVACCMD="$JAVA_HOME/jre/sh/javac"
|
||||||
|
else
|
||||||
|
JAVACMD="$JAVA_HOME/bin/java"
|
||||||
|
JAVACCMD="$JAVA_HOME/bin/javac"
|
||||||
|
|
||||||
|
if [ ! -x "$JAVACMD" ] || [ ! -x "$JAVACCMD" ]; then
|
||||||
|
echo "The JAVA_HOME environment variable is not defined correctly, so mvnw cannot run." >&2
|
||||||
|
echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" or \"\$JAVA_HOME/bin/javac\" does not exist." >&2
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
JAVACMD="$(
|
||||||
|
'set' +e
|
||||||
|
'unset' -f command 2>/dev/null
|
||||||
|
'command' -v java
|
||||||
|
)" || :
|
||||||
|
JAVACCMD="$(
|
||||||
|
'set' +e
|
||||||
|
'unset' -f command 2>/dev/null
|
||||||
|
'command' -v javac
|
||||||
|
)" || :
|
||||||
|
|
||||||
|
if [ ! -x "${JAVACMD-}" ] || [ ! -x "${JAVACCMD-}" ]; then
|
||||||
|
echo "The java/javac command does not exist in PATH nor is JAVA_HOME set, so mvnw cannot run." >&2
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# hash string like Java String::hashCode
|
||||||
|
hash_string() {
|
||||||
|
str="${1:-}" h=0
|
||||||
|
while [ -n "$str" ]; do
|
||||||
|
char="${str%"${str#?}"}"
|
||||||
|
h=$(((h * 31 + $(LC_CTYPE=C printf %d "'$char")) % 4294967296))
|
||||||
|
str="${str#?}"
|
||||||
|
done
|
||||||
|
printf %x\\n $h
|
||||||
|
}
|
||||||
|
|
||||||
|
verbose() { :; }
|
||||||
|
[ "${MVNW_VERBOSE-}" != true ] || verbose() { printf %s\\n "${1-}"; }
|
||||||
|
|
||||||
|
die() {
|
||||||
|
printf %s\\n "$1" >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
trim() {
|
||||||
|
# MWRAPPER-139:
|
||||||
|
# Trims trailing and leading whitespace, carriage returns, tabs, and linefeeds.
|
||||||
|
# Needed for removing poorly interpreted newline sequences when running in more
|
||||||
|
# exotic environments such as mingw bash on Windows.
|
||||||
|
printf "%s" "${1}" | tr -d '[:space:]'
|
||||||
|
}
|
||||||
|
|
||||||
|
scriptDir="$(dirname "$0")"
|
||||||
|
scriptName="$(basename "$0")"
|
||||||
|
|
||||||
|
# parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties
|
||||||
|
while IFS="=" read -r key value; do
|
||||||
|
case "${key-}" in
|
||||||
|
distributionUrl) distributionUrl=$(trim "${value-}") ;;
|
||||||
|
distributionSha256Sum) distributionSha256Sum=$(trim "${value-}") ;;
|
||||||
|
esac
|
||||||
|
done <"$scriptDir/.mvn/wrapper/maven-wrapper.properties"
|
||||||
|
[ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties"
|
||||||
|
|
||||||
|
case "${distributionUrl##*/}" in
|
||||||
|
maven-mvnd-*bin.*)
|
||||||
|
MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/
|
||||||
|
case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in
|
||||||
|
*AMD64:CYGWIN* | *AMD64:MINGW*) distributionPlatform=windows-amd64 ;;
|
||||||
|
:Darwin*x86_64) distributionPlatform=darwin-amd64 ;;
|
||||||
|
:Darwin*arm64) distributionPlatform=darwin-aarch64 ;;
|
||||||
|
:Linux*x86_64*) distributionPlatform=linux-amd64 ;;
|
||||||
|
*)
|
||||||
|
echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2
|
||||||
|
distributionPlatform=linux-amd64
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip"
|
||||||
|
;;
|
||||||
|
maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;;
|
||||||
|
*) MVN_CMD="mvn${scriptName#mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# apply MVNW_REPOURL and calculate MAVEN_HOME
|
||||||
|
# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-<version>,maven-mvnd-<version>-<platform>}/<hash>
|
||||||
|
[ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}"
|
||||||
|
distributionUrlName="${distributionUrl##*/}"
|
||||||
|
distributionUrlNameMain="${distributionUrlName%.*}"
|
||||||
|
distributionUrlNameMain="${distributionUrlNameMain%-bin}"
|
||||||
|
MAVEN_USER_HOME="${MAVEN_USER_HOME:-${HOME}/.m2}"
|
||||||
|
MAVEN_HOME="${MAVEN_USER_HOME}/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")"
|
||||||
|
|
||||||
|
exec_maven() {
|
||||||
|
unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || :
|
||||||
|
exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD"
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ -d "$MAVEN_HOME" ]; then
|
||||||
|
verbose "found existing MAVEN_HOME at $MAVEN_HOME"
|
||||||
|
exec_maven "$@"
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "${distributionUrl-}" in
|
||||||
|
*?-bin.zip | *?maven-mvnd-?*-?*.zip) ;;
|
||||||
|
*) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# prepare tmp dir
|
||||||
|
if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then
|
||||||
|
clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; }
|
||||||
|
trap clean HUP INT TERM EXIT
|
||||||
|
else
|
||||||
|
die "cannot create temp dir"
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p -- "${MAVEN_HOME%/*}"
|
||||||
|
|
||||||
|
# Download and Install Apache Maven
|
||||||
|
verbose "Couldn't find MAVEN_HOME, downloading and installing it ..."
|
||||||
|
verbose "Downloading from: $distributionUrl"
|
||||||
|
verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName"
|
||||||
|
|
||||||
|
# select .zip or .tar.gz
|
||||||
|
if ! command -v unzip >/dev/null; then
|
||||||
|
distributionUrl="${distributionUrl%.zip}.tar.gz"
|
||||||
|
distributionUrlName="${distributionUrl##*/}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# verbose opt
|
||||||
|
__MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR=''
|
||||||
|
[ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v
|
||||||
|
|
||||||
|
# normalize http auth
|
||||||
|
case "${MVNW_PASSWORD:+has-password}" in
|
||||||
|
'') MVNW_USERNAME='' MVNW_PASSWORD='' ;;
|
||||||
|
has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ -z "${MVNW_USERNAME-}" ] && command -v wget >/dev/null; then
|
||||||
|
verbose "Found wget ... using wget"
|
||||||
|
wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl"
|
||||||
|
elif [ -z "${MVNW_USERNAME-}" ] && command -v curl >/dev/null; then
|
||||||
|
verbose "Found curl ... using curl"
|
||||||
|
curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl"
|
||||||
|
elif set_java_home; then
|
||||||
|
verbose "Falling back to use Java to download"
|
||||||
|
javaSource="$TMP_DOWNLOAD_DIR/Downloader.java"
|
||||||
|
targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName"
|
||||||
|
cat >"$javaSource" <<-END
|
||||||
|
public class Downloader extends java.net.Authenticator
|
||||||
|
{
|
||||||
|
protected java.net.PasswordAuthentication getPasswordAuthentication()
|
||||||
|
{
|
||||||
|
return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() );
|
||||||
|
}
|
||||||
|
public static void main( String[] args ) throws Exception
|
||||||
|
{
|
||||||
|
setDefault( new Downloader() );
|
||||||
|
java.nio.file.Files.copy( java.net.URI.create( args[0] ).toURL().openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
END
|
||||||
|
# For Cygwin/MinGW, switch paths to Windows format before running javac and java
|
||||||
|
verbose " - Compiling Downloader.java ..."
|
||||||
|
"$(native_path "$JAVACCMD")" "$(native_path "$javaSource")" || die "Failed to compile Downloader.java"
|
||||||
|
verbose " - Running Downloader.java ..."
|
||||||
|
"$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If specified, validate the SHA-256 sum of the Maven distribution zip file
|
||||||
|
if [ -n "${distributionSha256Sum-}" ]; then
|
||||||
|
distributionSha256Result=false
|
||||||
|
if [ "$MVN_CMD" = mvnd.sh ]; then
|
||||||
|
echo "Checksum validation is not supported for maven-mvnd." >&2
|
||||||
|
echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2
|
||||||
|
exit 1
|
||||||
|
elif command -v sha256sum >/dev/null; then
|
||||||
|
if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c - >/dev/null 2>&1; then
|
||||||
|
distributionSha256Result=true
|
||||||
|
fi
|
||||||
|
elif command -v shasum >/dev/null; then
|
||||||
|
if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c >/dev/null 2>&1; then
|
||||||
|
distributionSha256Result=true
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2
|
||||||
|
echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [ $distributionSha256Result = false ]; then
|
||||||
|
echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2
|
||||||
|
echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# unzip and move
|
||||||
|
if command -v unzip >/dev/null; then
|
||||||
|
unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR" || die "failed to unzip"
|
||||||
|
else
|
||||||
|
tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR" || die "failed to untar"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Find the actual extracted directory name (handles snapshots where filename != directory name)
|
||||||
|
actualDistributionDir=""
|
||||||
|
|
||||||
|
# First try the expected directory name (for regular distributions)
|
||||||
|
if [ -d "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" ]; then
|
||||||
|
if [ -f "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/bin/$MVN_CMD" ]; then
|
||||||
|
actualDistributionDir="$distributionUrlNameMain"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If not found, search for any directory with the Maven executable (for snapshots)
|
||||||
|
if [ -z "$actualDistributionDir" ]; then
|
||||||
|
# enable globbing to iterate over items
|
||||||
|
set +f
|
||||||
|
for dir in "$TMP_DOWNLOAD_DIR"/*; do
|
||||||
|
if [ -d "$dir" ]; then
|
||||||
|
if [ -f "$dir/bin/$MVN_CMD" ]; then
|
||||||
|
actualDistributionDir="$(basename "$dir")"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
set -f
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$actualDistributionDir" ]; then
|
||||||
|
verbose "Contents of $TMP_DOWNLOAD_DIR:"
|
||||||
|
verbose "$(ls -la "$TMP_DOWNLOAD_DIR")"
|
||||||
|
die "Could not find Maven distribution directory in extracted archive"
|
||||||
|
fi
|
||||||
|
|
||||||
|
verbose "Found extracted Maven distribution directory: $actualDistributionDir"
|
||||||
|
printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$actualDistributionDir/mvnw.url"
|
||||||
|
mv -- "$TMP_DOWNLOAD_DIR/$actualDistributionDir" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME"
|
||||||
|
|
||||||
|
clean || :
|
||||||
|
exec_maven "$@"
|
||||||
189
mvnw.cmd
vendored
Executable file
189
mvnw.cmd
vendored
Executable file
@ -0,0 +1,189 @@
|
|||||||
|
<# : batch portion
|
||||||
|
@REM ----------------------------------------------------------------------------
|
||||||
|
@REM Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
@REM or more contributor license agreements. See the NOTICE file
|
||||||
|
@REM distributed with this work for additional information
|
||||||
|
@REM regarding copyright ownership. The ASF licenses this file
|
||||||
|
@REM to you under the Apache License, Version 2.0 (the
|
||||||
|
@REM "License"); you may not use this file except in compliance
|
||||||
|
@REM with the License. You may obtain a copy of the License at
|
||||||
|
@REM
|
||||||
|
@REM http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
@REM
|
||||||
|
@REM Unless required by applicable law or agreed to in writing,
|
||||||
|
@REM software distributed under the License is distributed on an
|
||||||
|
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
@REM KIND, either express or implied. See the License for the
|
||||||
|
@REM specific language governing permissions and limitations
|
||||||
|
@REM under the License.
|
||||||
|
@REM ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@REM ----------------------------------------------------------------------------
|
||||||
|
@REM Apache Maven Wrapper startup batch script, version 3.3.4
|
||||||
|
@REM
|
||||||
|
@REM Optional ENV vars
|
||||||
|
@REM MVNW_REPOURL - repo url base for downloading maven distribution
|
||||||
|
@REM MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven
|
||||||
|
@REM MVNW_VERBOSE - true: enable verbose log; others: silence the output
|
||||||
|
@REM ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@IF "%__MVNW_ARG0_NAME__%"=="" (SET __MVNW_ARG0_NAME__=%~nx0)
|
||||||
|
@SET __MVNW_CMD__=
|
||||||
|
@SET __MVNW_ERROR__=
|
||||||
|
@SET __MVNW_PSMODULEP_SAVE=%PSModulePath%
|
||||||
|
@SET PSModulePath=
|
||||||
|
@FOR /F "usebackq tokens=1* delims==" %%A IN (`powershell -noprofile "& {$scriptDir='%~dp0'; $script='%__MVNW_ARG0_NAME__%'; icm -ScriptBlock ([Scriptblock]::Create((Get-Content -Raw '%~f0'))) -NoNewScope}"`) DO @(
|
||||||
|
IF "%%A"=="MVN_CMD" (set __MVNW_CMD__=%%B) ELSE IF "%%B"=="" (echo %%A) ELSE (echo %%A=%%B)
|
||||||
|
)
|
||||||
|
@SET PSModulePath=%__MVNW_PSMODULEP_SAVE%
|
||||||
|
@SET __MVNW_PSMODULEP_SAVE=
|
||||||
|
@SET __MVNW_ARG0_NAME__=
|
||||||
|
@SET MVNW_USERNAME=
|
||||||
|
@SET MVNW_PASSWORD=
|
||||||
|
@IF NOT "%__MVNW_CMD__%"=="" ("%__MVNW_CMD__%" %*)
|
||||||
|
@echo Cannot start maven from wrapper >&2 && exit /b 1
|
||||||
|
@GOTO :EOF
|
||||||
|
: end batch / begin powershell #>
|
||||||
|
|
||||||
|
$ErrorActionPreference = "Stop"
|
||||||
|
if ($env:MVNW_VERBOSE -eq "true") {
|
||||||
|
$VerbosePreference = "Continue"
|
||||||
|
}
|
||||||
|
|
||||||
|
# calculate distributionUrl, requires .mvn/wrapper/maven-wrapper.properties
|
||||||
|
$distributionUrl = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionUrl
|
||||||
|
if (!$distributionUrl) {
|
||||||
|
Write-Error "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties"
|
||||||
|
}
|
||||||
|
|
||||||
|
switch -wildcard -casesensitive ( $($distributionUrl -replace '^.*/','') ) {
|
||||||
|
"maven-mvnd-*" {
|
||||||
|
$USE_MVND = $true
|
||||||
|
$distributionUrl = $distributionUrl -replace '-bin\.[^.]*$',"-windows-amd64.zip"
|
||||||
|
$MVN_CMD = "mvnd.cmd"
|
||||||
|
break
|
||||||
|
}
|
||||||
|
default {
|
||||||
|
$USE_MVND = $false
|
||||||
|
$MVN_CMD = $script -replace '^mvnw','mvn'
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# apply MVNW_REPOURL and calculate MAVEN_HOME
|
||||||
|
# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-<version>,maven-mvnd-<version>-<platform>}/<hash>
|
||||||
|
if ($env:MVNW_REPOURL) {
|
||||||
|
$MVNW_REPO_PATTERN = if ($USE_MVND -eq $False) { "/org/apache/maven/" } else { "/maven/mvnd/" }
|
||||||
|
$distributionUrl = "$env:MVNW_REPOURL$MVNW_REPO_PATTERN$($distributionUrl -replace "^.*$MVNW_REPO_PATTERN",'')"
|
||||||
|
}
|
||||||
|
$distributionUrlName = $distributionUrl -replace '^.*/',''
|
||||||
|
$distributionUrlNameMain = $distributionUrlName -replace '\.[^.]*$','' -replace '-bin$',''
|
||||||
|
|
||||||
|
$MAVEN_M2_PATH = "$HOME/.m2"
|
||||||
|
if ($env:MAVEN_USER_HOME) {
|
||||||
|
$MAVEN_M2_PATH = "$env:MAVEN_USER_HOME"
|
||||||
|
}
|
||||||
|
|
||||||
|
if (-not (Test-Path -Path $MAVEN_M2_PATH)) {
|
||||||
|
New-Item -Path $MAVEN_M2_PATH -ItemType Directory | Out-Null
|
||||||
|
}
|
||||||
|
|
||||||
|
$MAVEN_WRAPPER_DISTS = $null
|
||||||
|
if ((Get-Item $MAVEN_M2_PATH).Target[0] -eq $null) {
|
||||||
|
$MAVEN_WRAPPER_DISTS = "$MAVEN_M2_PATH/wrapper/dists"
|
||||||
|
} else {
|
||||||
|
$MAVEN_WRAPPER_DISTS = (Get-Item $MAVEN_M2_PATH).Target[0] + "/wrapper/dists"
|
||||||
|
}
|
||||||
|
|
||||||
|
$MAVEN_HOME_PARENT = "$MAVEN_WRAPPER_DISTS/$distributionUrlNameMain"
|
||||||
|
$MAVEN_HOME_NAME = ([System.Security.Cryptography.SHA256]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object {$_.ToString("x2")}) -join ''
|
||||||
|
$MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME"
|
||||||
|
|
||||||
|
if (Test-Path -Path "$MAVEN_HOME" -PathType Container) {
|
||||||
|
Write-Verbose "found existing MAVEN_HOME at $MAVEN_HOME"
|
||||||
|
Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD"
|
||||||
|
exit $?
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $distributionUrlNameMain -or ($distributionUrlName -eq $distributionUrlNameMain)) {
|
||||||
|
Write-Error "distributionUrl is not valid, must end with *-bin.zip, but found $distributionUrl"
|
||||||
|
}
|
||||||
|
|
||||||
|
# prepare tmp dir
|
||||||
|
$TMP_DOWNLOAD_DIR_HOLDER = New-TemporaryFile
|
||||||
|
$TMP_DOWNLOAD_DIR = New-Item -Itemtype Directory -Path "$TMP_DOWNLOAD_DIR_HOLDER.dir"
|
||||||
|
$TMP_DOWNLOAD_DIR_HOLDER.Delete() | Out-Null
|
||||||
|
trap {
|
||||||
|
if ($TMP_DOWNLOAD_DIR.Exists) {
|
||||||
|
try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null }
|
||||||
|
catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
New-Item -Itemtype Directory -Path "$MAVEN_HOME_PARENT" -Force | Out-Null
|
||||||
|
|
||||||
|
# Download and Install Apache Maven
|
||||||
|
Write-Verbose "Couldn't find MAVEN_HOME, downloading and installing it ..."
|
||||||
|
Write-Verbose "Downloading from: $distributionUrl"
|
||||||
|
Write-Verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName"
|
||||||
|
|
||||||
|
$webclient = New-Object System.Net.WebClient
|
||||||
|
if ($env:MVNW_USERNAME -and $env:MVNW_PASSWORD) {
|
||||||
|
$webclient.Credentials = New-Object System.Net.NetworkCredential($env:MVNW_USERNAME, $env:MVNW_PASSWORD)
|
||||||
|
}
|
||||||
|
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||||
|
$webclient.DownloadFile($distributionUrl, "$TMP_DOWNLOAD_DIR/$distributionUrlName") | Out-Null
|
||||||
|
|
||||||
|
# If specified, validate the SHA-256 sum of the Maven distribution zip file
|
||||||
|
$distributionSha256Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha256Sum
|
||||||
|
if ($distributionSha256Sum) {
|
||||||
|
if ($USE_MVND) {
|
||||||
|
Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties."
|
||||||
|
}
|
||||||
|
Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash
|
||||||
|
if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA256).Hash.ToLower() -ne $distributionSha256Sum) {
|
||||||
|
Write-Error "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised. If you updated your Maven version, you need to update the specified distributionSha256Sum property."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# unzip and move
|
||||||
|
Expand-Archive "$TMP_DOWNLOAD_DIR/$distributionUrlName" -DestinationPath "$TMP_DOWNLOAD_DIR" | Out-Null
|
||||||
|
|
||||||
|
# Find the actual extracted directory name (handles snapshots where filename != directory name)
|
||||||
|
$actualDistributionDir = ""
|
||||||
|
|
||||||
|
# First try the expected directory name (for regular distributions)
|
||||||
|
$expectedPath = Join-Path "$TMP_DOWNLOAD_DIR" "$distributionUrlNameMain"
|
||||||
|
$expectedMvnPath = Join-Path "$expectedPath" "bin/$MVN_CMD"
|
||||||
|
if ((Test-Path -Path $expectedPath -PathType Container) -and (Test-Path -Path $expectedMvnPath -PathType Leaf)) {
|
||||||
|
$actualDistributionDir = $distributionUrlNameMain
|
||||||
|
}
|
||||||
|
|
||||||
|
# If not found, search for any directory with the Maven executable (for snapshots)
|
||||||
|
if (!$actualDistributionDir) {
|
||||||
|
Get-ChildItem -Path "$TMP_DOWNLOAD_DIR" -Directory | ForEach-Object {
|
||||||
|
$testPath = Join-Path $_.FullName "bin/$MVN_CMD"
|
||||||
|
if (Test-Path -Path $testPath -PathType Leaf) {
|
||||||
|
$actualDistributionDir = $_.Name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$actualDistributionDir) {
|
||||||
|
Write-Error "Could not find Maven distribution directory in extracted archive"
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Verbose "Found extracted Maven distribution directory: $actualDistributionDir"
|
||||||
|
Rename-Item -Path "$TMP_DOWNLOAD_DIR/$actualDistributionDir" -NewName $MAVEN_HOME_NAME | Out-Null
|
||||||
|
try {
|
||||||
|
Move-Item -Path "$TMP_DOWNLOAD_DIR/$MAVEN_HOME_NAME" -Destination $MAVEN_HOME_PARENT | Out-Null
|
||||||
|
} catch {
|
||||||
|
if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) {
|
||||||
|
Write-Error "fail to move MAVEN_HOME"
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null }
|
||||||
|
catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" }
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD"
|
||||||
180
pom.xml
Normal file
180
pom.xml
Normal file
@ -0,0 +1,180 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>dev.dinauer.maven</groupId>
|
||||||
|
<artifactId>core</artifactId>
|
||||||
|
<version>1.0.0-SNAPSHOT</version>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<compiler-plugin.version>3.14.1</compiler-plugin.version>
|
||||||
|
<maven.compiler.release>21</maven.compiler.release>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
|
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
|
||||||
|
<quarkus.platform.group-id>io.quarkus.platform</quarkus.platform.group-id>
|
||||||
|
<quarkus.platform.version>3.30.8</quarkus.platform.version>
|
||||||
|
<skipITs>true</skipITs>
|
||||||
|
<surefire-plugin.version>3.5.4</surefire-plugin.version>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencyManagement>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>${quarkus.platform.group-id}</groupId>
|
||||||
|
<artifactId>${quarkus.platform.artifact-id}</artifactId>
|
||||||
|
<version>${quarkus.platform.version}</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</dependencyManagement>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.quarkus</groupId>
|
||||||
|
<artifactId>quarkus-hibernate-orm-rest-data-panache</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.quarkus</groupId>
|
||||||
|
<artifactId>quarkus-rest</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.quarkus</groupId>
|
||||||
|
<artifactId>quarkus-rest-jackson</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.quarkus</groupId>
|
||||||
|
<artifactId>quarkus-rest-client-jackson</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.quarkus</groupId>
|
||||||
|
<artifactId>quarkus-oidc</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.quarkus</groupId>
|
||||||
|
<artifactId>quarkus-oidc-client</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.quarkus</groupId>
|
||||||
|
<artifactId>quarkus-rest-client-oidc-filter</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.quarkus</groupId>
|
||||||
|
<artifactId>quarkus-jdbc-postgresql</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.quarkus</groupId>
|
||||||
|
<artifactId>quarkus-elytron-security</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.quarkus</groupId>
|
||||||
|
<artifactId>quarkus-arc</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-io</groupId>
|
||||||
|
<artifactId>commons-io</artifactId>
|
||||||
|
<version>2.21.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-codec</groupId>
|
||||||
|
<artifactId>commons-codec</artifactId>
|
||||||
|
<version>1.16.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
||||||
|
<artifactId>jackson-dataformat-xml</artifactId>
|
||||||
|
<version>2.21.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.maven</groupId>
|
||||||
|
<artifactId>maven-artifact</artifactId>
|
||||||
|
<version>3.9.12</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.quarkus</groupId>
|
||||||
|
<artifactId>quarkus-junit5</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.rest-assured</groupId>
|
||||||
|
<artifactId>rest-assured</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>${quarkus.platform.group-id}</groupId>
|
||||||
|
<artifactId>quarkus-maven-plugin</artifactId>
|
||||||
|
<version>${quarkus.platform.version}</version>
|
||||||
|
<extensions>true</extensions>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>build</goal>
|
||||||
|
<goal>generate-code</goal>
|
||||||
|
<goal>generate-code-tests</goal>
|
||||||
|
<goal>native-image-agent</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>${compiler-plugin.version}</version>
|
||||||
|
<configuration>
|
||||||
|
<parameters>true</parameters>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
<version>${surefire-plugin.version}</version>
|
||||||
|
<configuration>
|
||||||
|
<argLine>--add-opens java.base/java.lang=ALL-UNNAMED</argLine>
|
||||||
|
<systemPropertyVariables>
|
||||||
|
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
|
||||||
|
<maven.home>${maven.home}</maven.home>
|
||||||
|
</systemPropertyVariables>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-failsafe-plugin</artifactId>
|
||||||
|
<version>${surefire-plugin.version}</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>integration-test</goal>
|
||||||
|
<goal>verify</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
<configuration>
|
||||||
|
<argLine>--add-opens java.base/java.lang=ALL-UNNAMED</argLine>
|
||||||
|
<systemPropertyVariables>
|
||||||
|
<native.image.path>${project.build.directory}/${project.build.finalName}-runner</native.image.path>
|
||||||
|
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
|
||||||
|
<maven.home>${maven.home}</maven.home>
|
||||||
|
</systemPropertyVariables>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
<profiles>
|
||||||
|
<profile>
|
||||||
|
<id>native</id>
|
||||||
|
<activation>
|
||||||
|
<property>
|
||||||
|
<name>native</name>
|
||||||
|
</property>
|
||||||
|
</activation>
|
||||||
|
<properties>
|
||||||
|
<quarkus.package.jar.enabled>false</quarkus.package.jar.enabled>
|
||||||
|
<skipITs>false</skipITs>
|
||||||
|
<quarkus.native.enabled>true</quarkus.native.enabled>
|
||||||
|
</properties>
|
||||||
|
</profile>
|
||||||
|
</profiles>
|
||||||
|
</project>
|
||||||
98
src/main/docker/Dockerfile.jvm
Normal file
98
src/main/docker/Dockerfile.jvm
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
####
|
||||||
|
# This Dockerfile is used in order to build a container that runs the Quarkus application in JVM mode
|
||||||
|
#
|
||||||
|
# Before building the container image run:
|
||||||
|
#
|
||||||
|
# ./mvnw package
|
||||||
|
#
|
||||||
|
# Then, build the image with:
|
||||||
|
#
|
||||||
|
# docker build -f src/main/docker/Dockerfile.jvm -t quarkus/core-jvm .
|
||||||
|
#
|
||||||
|
# Then run the container using:
|
||||||
|
#
|
||||||
|
# docker run -i --rm -p 8080:8080 quarkus/core-jvm
|
||||||
|
#
|
||||||
|
# If you want to include the debug port into your docker image
|
||||||
|
# you will have to expose the debug port (default 5005 being the default) like this : EXPOSE 8080 5005.
|
||||||
|
# Additionally you will have to set -e JAVA_DEBUG=true and -e JAVA_DEBUG_PORT=*:5005
|
||||||
|
# when running the container
|
||||||
|
#
|
||||||
|
# Then run the container using :
|
||||||
|
#
|
||||||
|
# docker run -i --rm -p 8080:8080 quarkus/core-jvm
|
||||||
|
#
|
||||||
|
# This image uses the `run-java.sh` script to run the application.
|
||||||
|
# This scripts computes the command line to execute your Java application, and
|
||||||
|
# includes memory/GC tuning.
|
||||||
|
# You can configure the behavior using the following environment properties:
|
||||||
|
# - JAVA_OPTS: JVM options passed to the `java` command (example: "-verbose:class") - Be aware that this will override
|
||||||
|
# the default JVM options, use `JAVA_OPTS_APPEND` to append options
|
||||||
|
# - JAVA_OPTS_APPEND: User specified Java options to be appended to generated options
|
||||||
|
# in JAVA_OPTS (example: "-Dsome.property=foo")
|
||||||
|
# - JAVA_MAX_MEM_RATIO: Is used when no `-Xmx` option is given in JAVA_OPTS. This is
|
||||||
|
# used to calculate a default maximal heap memory based on a containers restriction.
|
||||||
|
# If used in a container without any memory constraints for the container then this
|
||||||
|
# option has no effect. If there is a memory constraint then `-Xmx` is set to a ratio
|
||||||
|
# of the container available memory as set here. The default is `50` which means 50%
|
||||||
|
# of the available memory is used as an upper boundary. You can skip this mechanism by
|
||||||
|
# setting this value to `0` in which case no `-Xmx` option is added.
|
||||||
|
# - JAVA_INITIAL_MEM_RATIO: Is used when no `-Xms` option is given in JAVA_OPTS. This
|
||||||
|
# is used to calculate a default initial heap memory based on the maximum heap memory.
|
||||||
|
# If used in a container without any memory constraints for the container then this
|
||||||
|
# option has no effect. If there is a memory constraint then `-Xms` is set to a ratio
|
||||||
|
# of the `-Xmx` memory as set here. The default is `25` which means 25% of the `-Xmx`
|
||||||
|
# is used as the initial heap size. You can skip this mechanism by setting this value
|
||||||
|
# to `0` in which case no `-Xms` option is added (example: "25")
|
||||||
|
# - JAVA_MAX_INITIAL_MEM: Is used when no `-Xms` option is given in JAVA_OPTS.
|
||||||
|
# This is used to calculate the maximum value of the initial heap memory. If used in
|
||||||
|
# a container without any memory constraints for the container then this option has
|
||||||
|
# no effect. If there is a memory constraint then `-Xms` is limited to the value set
|
||||||
|
# here. The default is 4096MB which means the calculated value of `-Xms` never will
|
||||||
|
# be greater than 4096MB. The value of this variable is expressed in MB (example: "4096")
|
||||||
|
# - JAVA_DIAGNOSTICS: Set this to get some diagnostics information to standard output
|
||||||
|
# when things are happening. This option, if set to true, will set
|
||||||
|
# `-XX:+UnlockDiagnosticVMOptions`. Disabled by default (example: "true").
|
||||||
|
# - JAVA_DEBUG: If set remote debugging will be switched on. Disabled by default (example:
|
||||||
|
# true").
|
||||||
|
# - JAVA_DEBUG_PORT: Port used for remote debugging. Defaults to 5005 (example: "8787").
|
||||||
|
# - CONTAINER_CORE_LIMIT: A calculated core limit as described in
|
||||||
|
# https://www.kernel.org/doc/Documentation/scheduler/sched-bwc.txt. (example: "2")
|
||||||
|
# - CONTAINER_MAX_MEMORY: Memory limit given to the container (example: "1024").
|
||||||
|
# - GC_MIN_HEAP_FREE_RATIO: Minimum percentage of heap free after GC to avoid expansion.
|
||||||
|
# (example: "20")
|
||||||
|
# - GC_MAX_HEAP_FREE_RATIO: Maximum percentage of heap free after GC to avoid shrinking.
|
||||||
|
# (example: "40")
|
||||||
|
# - GC_TIME_RATIO: Specifies the ratio of the time spent outside the garbage collection.
|
||||||
|
# (example: "4")
|
||||||
|
# - GC_ADAPTIVE_SIZE_POLICY_WEIGHT: The weighting given to the current GC time versus
|
||||||
|
# previous GC times. (example: "90")
|
||||||
|
# - GC_METASPACE_SIZE: The initial metaspace size. (example: "20")
|
||||||
|
# - GC_MAX_METASPACE_SIZE: The maximum metaspace size. (example: "100")
|
||||||
|
# - GC_CONTAINER_OPTIONS: Specify Java GC to use. The value of this variable should
|
||||||
|
# contain the necessary JRE command-line options to specify the required GC, which
|
||||||
|
# will override the default of `-XX:+UseParallelGC` (example: -XX:+UseG1GC).
|
||||||
|
# - HTTPS_PROXY: The location of the https proxy. (example: "myuser@127.0.0.1:8080")
|
||||||
|
# - HTTP_PROXY: The location of the http proxy. (example: "myuser@127.0.0.1:8080")
|
||||||
|
# - NO_PROXY: A comma separated lists of hosts, IP addresses or domains that can be
|
||||||
|
# accessed directly. (example: "foo.example.com,bar.example.com")
|
||||||
|
#
|
||||||
|
###
|
||||||
|
FROM registry.access.redhat.com/ubi9/openjdk-21:1.23
|
||||||
|
|
||||||
|
ENV LANGUAGE='en_US:en'
|
||||||
|
|
||||||
|
|
||||||
|
# We make four distinct layers so if there are application changes the library layers can be re-used
|
||||||
|
COPY --chown=185 target/quarkus-app/lib/ /deployments/lib/
|
||||||
|
COPY --chown=185 target/quarkus-app/*.jar /deployments/
|
||||||
|
COPY --chown=185 target/quarkus-app/app/ /deployments/app/
|
||||||
|
COPY --chown=185 target/quarkus-app/quarkus/ /deployments/quarkus/
|
||||||
|
|
||||||
|
EXPOSE 8080
|
||||||
|
USER 185
|
||||||
|
ENV JAVA_OPTS_APPEND="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
|
||||||
|
ENV JAVA_APP_JAR="/deployments/quarkus-run.jar"
|
||||||
|
|
||||||
|
ENTRYPOINT [ "/opt/jboss/container/java/run/run-java.sh" ]
|
||||||
|
|
||||||
94
src/main/docker/Dockerfile.legacy-jar
Normal file
94
src/main/docker/Dockerfile.legacy-jar
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
####
|
||||||
|
# This Dockerfile is used in order to build a container that runs the Quarkus application in JVM mode
|
||||||
|
#
|
||||||
|
# Before building the container image run:
|
||||||
|
#
|
||||||
|
# ./mvnw package -Dquarkus.package.jar.type=legacy-jar
|
||||||
|
#
|
||||||
|
# Then, build the image with:
|
||||||
|
#
|
||||||
|
# docker build -f src/main/docker/Dockerfile.legacy-jar -t quarkus/core-legacy-jar .
|
||||||
|
#
|
||||||
|
# Then run the container using:
|
||||||
|
#
|
||||||
|
# docker run -i --rm -p 8080:8080 quarkus/core-legacy-jar
|
||||||
|
#
|
||||||
|
# If you want to include the debug port into your docker image
|
||||||
|
# you will have to expose the debug port (default 5005 being the default) like this : EXPOSE 8080 5005.
|
||||||
|
# Additionally you will have to set -e JAVA_DEBUG=true and -e JAVA_DEBUG_PORT=*:5005
|
||||||
|
# when running the container
|
||||||
|
#
|
||||||
|
# Then run the container using :
|
||||||
|
#
|
||||||
|
# docker run -i --rm -p 8080:8080 quarkus/core-legacy-jar
|
||||||
|
#
|
||||||
|
# This image uses the `run-java.sh` script to run the application.
|
||||||
|
# This scripts computes the command line to execute your Java application, and
|
||||||
|
# includes memory/GC tuning.
|
||||||
|
# You can configure the behavior using the following environment properties:
|
||||||
|
# - JAVA_OPTS: JVM options passed to the `java` command (example: "-verbose:class") - Be aware that this will override
|
||||||
|
# the default JVM options, use `JAVA_OPTS_APPEND` to append options
|
||||||
|
# - JAVA_OPTS_APPEND: User specified Java options to be appended to generated options
|
||||||
|
# in JAVA_OPTS (example: "-Dsome.property=foo")
|
||||||
|
# - JAVA_MAX_MEM_RATIO: Is used when no `-Xmx` option is given in JAVA_OPTS. This is
|
||||||
|
# used to calculate a default maximal heap memory based on a containers restriction.
|
||||||
|
# If used in a container without any memory constraints for the container then this
|
||||||
|
# option has no effect. If there is a memory constraint then `-Xmx` is set to a ratio
|
||||||
|
# of the container available memory as set here. The default is `50` which means 50%
|
||||||
|
# of the available memory is used as an upper boundary. You can skip this mechanism by
|
||||||
|
# setting this value to `0` in which case no `-Xmx` option is added.
|
||||||
|
# - JAVA_INITIAL_MEM_RATIO: Is used when no `-Xms` option is given in JAVA_OPTS. This
|
||||||
|
# is used to calculate a default initial heap memory based on the maximum heap memory.
|
||||||
|
# If used in a container without any memory constraints for the container then this
|
||||||
|
# option has no effect. If there is a memory constraint then `-Xms` is set to a ratio
|
||||||
|
# of the `-Xmx` memory as set here. The default is `25` which means 25% of the `-Xmx`
|
||||||
|
# is used as the initial heap size. You can skip this mechanism by setting this value
|
||||||
|
# to `0` in which case no `-Xms` option is added (example: "25")
|
||||||
|
# - JAVA_MAX_INITIAL_MEM: Is used when no `-Xms` option is given in JAVA_OPTS.
|
||||||
|
# This is used to calculate the maximum value of the initial heap memory. If used in
|
||||||
|
# a container without any memory constraints for the container then this option has
|
||||||
|
# no effect. If there is a memory constraint then `-Xms` is limited to the value set
|
||||||
|
# here. The default is 4096MB which means the calculated value of `-Xms` never will
|
||||||
|
# be greater than 4096MB. The value of this variable is expressed in MB (example: "4096")
|
||||||
|
# - JAVA_DIAGNOSTICS: Set this to get some diagnostics information to standard output
|
||||||
|
# when things are happening. This option, if set to true, will set
|
||||||
|
# `-XX:+UnlockDiagnosticVMOptions`. Disabled by default (example: "true").
|
||||||
|
# - JAVA_DEBUG: If set remote debugging will be switched on. Disabled by default (example:
|
||||||
|
# true").
|
||||||
|
# - JAVA_DEBUG_PORT: Port used for remote debugging. Defaults to 5005 (example: "8787").
|
||||||
|
# - CONTAINER_CORE_LIMIT: A calculated core limit as described in
|
||||||
|
# https://www.kernel.org/doc/Documentation/scheduler/sched-bwc.txt. (example: "2")
|
||||||
|
# - CONTAINER_MAX_MEMORY: Memory limit given to the container (example: "1024").
|
||||||
|
# - GC_MIN_HEAP_FREE_RATIO: Minimum percentage of heap free after GC to avoid expansion.
|
||||||
|
# (example: "20")
|
||||||
|
# - GC_MAX_HEAP_FREE_RATIO: Maximum percentage of heap free after GC to avoid shrinking.
|
||||||
|
# (example: "40")
|
||||||
|
# - GC_TIME_RATIO: Specifies the ratio of the time spent outside the garbage collection.
|
||||||
|
# (example: "4")
|
||||||
|
# - GC_ADAPTIVE_SIZE_POLICY_WEIGHT: The weighting given to the current GC time versus
|
||||||
|
# previous GC times. (example: "90")
|
||||||
|
# - GC_METASPACE_SIZE: The initial metaspace size. (example: "20")
|
||||||
|
# - GC_MAX_METASPACE_SIZE: The maximum metaspace size. (example: "100")
|
||||||
|
# - GC_CONTAINER_OPTIONS: Specify Java GC to use. The value of this variable should
|
||||||
|
# contain the necessary JRE command-line options to specify the required GC, which
|
||||||
|
# will override the default of `-XX:+UseParallelGC` (example: -XX:+UseG1GC).
|
||||||
|
# - HTTPS_PROXY: The location of the https proxy. (example: "myuser@127.0.0.1:8080")
|
||||||
|
# - HTTP_PROXY: The location of the http proxy. (example: "myuser@127.0.0.1:8080")
|
||||||
|
# - NO_PROXY: A comma separated lists of hosts, IP addresses or domains that can be
|
||||||
|
# accessed directly. (example: "foo.example.com,bar.example.com")
|
||||||
|
#
|
||||||
|
###
|
||||||
|
FROM registry.access.redhat.com/ubi9/openjdk-21:1.23
|
||||||
|
|
||||||
|
ENV LANGUAGE='en_US:en'
|
||||||
|
|
||||||
|
|
||||||
|
COPY target/lib/* /deployments/lib/
|
||||||
|
COPY target/*-runner.jar /deployments/quarkus-run.jar
|
||||||
|
|
||||||
|
EXPOSE 8080
|
||||||
|
USER 185
|
||||||
|
ENV JAVA_OPTS_APPEND="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
|
||||||
|
ENV JAVA_APP_JAR="/deployments/quarkus-run.jar"
|
||||||
|
|
||||||
|
ENTRYPOINT [ "/opt/jboss/container/java/run/run-java.sh" ]
|
||||||
29
src/main/docker/Dockerfile.native
Normal file
29
src/main/docker/Dockerfile.native
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
####
|
||||||
|
# This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode.
|
||||||
|
#
|
||||||
|
# Before building the container image run:
|
||||||
|
#
|
||||||
|
# ./mvnw package -Dnative
|
||||||
|
#
|
||||||
|
# Then, build the image with:
|
||||||
|
#
|
||||||
|
# docker build -f src/main/docker/Dockerfile.native -t quarkus/core .
|
||||||
|
#
|
||||||
|
# Then run the container using:
|
||||||
|
#
|
||||||
|
# docker run -i --rm -p 8080:8080 quarkus/core
|
||||||
|
#
|
||||||
|
# The ` registry.access.redhat.com/ubi9/ubi-minimal:9.7` base image is based on UBI 9.
|
||||||
|
# To use UBI 8, switch to `quay.io/ubi8/ubi-minimal:8.10`.
|
||||||
|
###
|
||||||
|
FROM registry.access.redhat.com/ubi9/ubi-minimal:9.7
|
||||||
|
WORKDIR /work/
|
||||||
|
RUN chown 1001 /work \
|
||||||
|
&& chmod "g+rwX" /work \
|
||||||
|
&& chown 1001:root /work
|
||||||
|
COPY --chown=1001:root --chmod=0755 target/*-runner /work/application
|
||||||
|
|
||||||
|
EXPOSE 8080
|
||||||
|
USER 1001
|
||||||
|
|
||||||
|
ENTRYPOINT ["./application", "-Dquarkus.http.host=0.0.0.0"]
|
||||||
32
src/main/docker/Dockerfile.native-micro
Normal file
32
src/main/docker/Dockerfile.native-micro
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
####
|
||||||
|
# This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode.
|
||||||
|
# It uses a micro base image, tuned for Quarkus native executables.
|
||||||
|
# It reduces the size of the resulting container image.
|
||||||
|
# Check https://quarkus.io/guides/quarkus-runtime-base-image for further information about this image.
|
||||||
|
#
|
||||||
|
# Before building the container image run:
|
||||||
|
#
|
||||||
|
# ./mvnw package -Dnative
|
||||||
|
#
|
||||||
|
# Then, build the image with:
|
||||||
|
#
|
||||||
|
# docker build -f src/main/docker/Dockerfile.native-micro -t quarkus/core .
|
||||||
|
#
|
||||||
|
# Then run the container using:
|
||||||
|
#
|
||||||
|
# docker run -i --rm -p 8080:8080 quarkus/core
|
||||||
|
#
|
||||||
|
# The `quay.io/quarkus/ubi9-quarkus-micro-image:2.0` base image is based on UBI 9.
|
||||||
|
# To use UBI 8, switch to `quay.io/quarkus/quarkus-micro-image:2.0`.
|
||||||
|
###
|
||||||
|
FROM quay.io/quarkus/ubi9-quarkus-micro-image:2.0
|
||||||
|
WORKDIR /work/
|
||||||
|
RUN chown 1001 /work \
|
||||||
|
&& chmod "g+rwX" /work \
|
||||||
|
&& chown 1001:root /work
|
||||||
|
COPY --chown=1001:root --chmod=0755 target/*-runner /work/application
|
||||||
|
|
||||||
|
EXPOSE 8080
|
||||||
|
USER 1001
|
||||||
|
|
||||||
|
ENTRYPOINT ["./application", "-Dquarkus.http.host=0.0.0.0"]
|
||||||
@ -0,0 +1,58 @@
|
|||||||
|
package dev.dinauer.maven;
|
||||||
|
|
||||||
|
import io.quarkus.oidc.AccessTokenCredential;
|
||||||
|
import io.quarkus.security.credential.PasswordCredential;
|
||||||
|
import io.quarkus.security.credential.TokenCredential;
|
||||||
|
import io.quarkus.security.identity.IdentityProviderManager;
|
||||||
|
import io.quarkus.security.identity.SecurityIdentity;
|
||||||
|
import io.quarkus.security.identity.request.TokenAuthenticationRequest;
|
||||||
|
import io.quarkus.security.identity.request.UsernamePasswordAuthenticationRequest;
|
||||||
|
import io.quarkus.security.runtime.QuarkusSecurityIdentity;
|
||||||
|
import io.quarkus.vertx.http.runtime.security.ChallengeData;
|
||||||
|
import io.quarkus.vertx.http.runtime.security.HttpAuthenticationMechanism;
|
||||||
|
import io.quarkus.vertx.http.runtime.security.HttpSecurityUtils;
|
||||||
|
import io.smallrye.mutiny.Uni;
|
||||||
|
import io.vertx.core.http.Cookie;
|
||||||
|
import io.vertx.ext.web.RoutingContext;
|
||||||
|
import jakarta.enterprise.context.ApplicationScoped;
|
||||||
|
import jakarta.inject.Inject;
|
||||||
|
import net.bytebuddy.implementation.bind.MethodDelegationBinder;
|
||||||
|
import org.jboss.logging.Logger;
|
||||||
|
|
||||||
|
@ApplicationScoped
|
||||||
|
public class CustomAuthenticationMechanism implements HttpAuthenticationMechanism
|
||||||
|
{
|
||||||
|
private static final String SESSION_COOKIE = "session";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Uni<SecurityIdentity> authenticate(RoutingContext context, IdentityProviderManager identityProviderManager)
|
||||||
|
{
|
||||||
|
context.put(CustomAuthenticationMechanism.class.getName(), this);
|
||||||
|
Cookie cookie = context.request().getCookie(SESSION_COOKIE);
|
||||||
|
if (cookie != null)
|
||||||
|
{
|
||||||
|
String value = cookie.getValue();
|
||||||
|
TokenAuthenticationRequest request = new TokenAuthenticationRequest(new AccessTokenCredential(value));
|
||||||
|
HttpSecurityUtils.setRoutingContextAttribute(request, context);
|
||||||
|
return identityProviderManager.authenticate(request);
|
||||||
|
}
|
||||||
|
String authHeader = context.request().getHeader("Authorization");
|
||||||
|
if (authHeader != null && authHeader.startsWith("Basic "))
|
||||||
|
{
|
||||||
|
String[] sections = authHeader.split("\\s+");
|
||||||
|
if (sections.length == 2)
|
||||||
|
{
|
||||||
|
UsernamePasswordAuthenticationRequest request = new UsernamePasswordAuthenticationRequest(sections[0], new PasswordCredential(sections[1].toCharArray()));
|
||||||
|
HttpSecurityUtils.setRoutingContextAttribute(request, context);
|
||||||
|
return identityProviderManager.authenticate(request);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Uni.createFrom().nullItem();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Uni<ChallengeData> getChallenge(RoutingContext context)
|
||||||
|
{
|
||||||
|
return Uni.createFrom().nullItem();
|
||||||
|
}
|
||||||
|
}
|
||||||
33
src/main/java/dev/dinauer/maven/Dev.java
Normal file
33
src/main/java/dev/dinauer/maven/Dev.java
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
package dev.dinauer.maven;
|
||||||
|
|
||||||
|
import dev.dinauer.maven.maven.core.Service;
|
||||||
|
import io.quarkus.arc.profile.IfBuildProfile;
|
||||||
|
import io.quarkus.runtime.Startup;
|
||||||
|
import jakarta.enterprise.context.ApplicationScoped;
|
||||||
|
import jakarta.inject.Inject;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
|
||||||
|
@ApplicationScoped
|
||||||
|
@IfBuildProfile("test")
|
||||||
|
public class Dev
|
||||||
|
{
|
||||||
|
@Inject
|
||||||
|
Service service;
|
||||||
|
|
||||||
|
@Startup
|
||||||
|
void init() throws IOException
|
||||||
|
{
|
||||||
|
service.upload("/org/apache/httpcomponents/client5/httpclient5/5.6/httpclient5-5.6.jar", Files.readAllBytes(Path.of("/home/andreas/Documents/dev/maven/core/core/src/main/resources/jar/httpclient5-5.6.jar"))).close();
|
||||||
|
|
||||||
|
service.upload("/com/fasterxml/jackson/core/jackson-core/2.21.0/jackson-core-2.21.0.jar", Files.readAllBytes(Path.of("/home/andreas/Documents/dev/maven/core/core/src/main/resources/jar/jackson-core-2.21.0.jar"))).close();
|
||||||
|
|
||||||
|
service.upload("/org/postgresql/postgresql/42.7.9/postgresql-42.7.9.jar", Files.readAllBytes(Path.of("/home/andreas/Documents/dev/maven/core/core/src/main/resources/jar/postgresql-42.7.9.jar"))).close();
|
||||||
|
service.upload("/org/postgresql/postgresql/42.2.9/postgresql-42.2.9.jar", Files.readAllBytes(Path.of("/home/andreas/Documents/dev/maven/core/core/src/main/resources/jar/postgresql-42.7.9.jar"))).close();
|
||||||
|
service.upload("/org/postgresql/postgresql/42.4.9/postgresql-42.4.9.jar", Files.readAllBytes(Path.of("/home/andreas/Documents/dev/maven/core/core/src/main/resources/jar/postgresql-42.7.9.jar"))).close();
|
||||||
|
service.upload("/org/postgresql/postgresql/41.4.9/postgresql-41.4.9.jar", Files.readAllBytes(Path.of("/home/andreas/Documents/dev/maven/core/core/src/main/resources/jar/postgresql-42.7.9.jar"))).close();
|
||||||
|
service.upload("/org/postgresql/postgresql/41.4.9/postgresql-41.4.9.pom", Files.readAllBytes(Path.of("/home/andreas/Documents/dev/maven/core/core/src/main/resources/jar/postgresql-42.7.9.pom"))).close();
|
||||||
|
}
|
||||||
|
}
|
||||||
43
src/main/java/dev/dinauer/maven/OidcCallback.java
Normal file
43
src/main/java/dev/dinauer/maven/OidcCallback.java
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
package dev.dinauer.maven;
|
||||||
|
|
||||||
|
import io.quarkus.oidc.client.NamedOidcClient;
|
||||||
|
import io.quarkus.oidc.client.OidcClient;
|
||||||
|
import io.quarkus.oidc.client.Tokens;
|
||||||
|
import jakarta.annotation.security.PermitAll;
|
||||||
|
import jakarta.inject.Inject;
|
||||||
|
import jakarta.ws.rs.GET;
|
||||||
|
import jakarta.ws.rs.Path;
|
||||||
|
import jakarta.ws.rs.QueryParam;
|
||||||
|
import jakarta.ws.rs.core.NewCookie;
|
||||||
|
import jakarta.ws.rs.core.Response;
|
||||||
|
|
||||||
|
import java.net.URI;
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.time.ZonedDateTime;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Path("/callback")
|
||||||
|
public class OidcCallback
|
||||||
|
{
|
||||||
|
@Inject
|
||||||
|
@NamedOidcClient("ac")
|
||||||
|
OidcClient client;
|
||||||
|
|
||||||
|
@GET
|
||||||
|
public Response callback(@QueryParam("code") String code)
|
||||||
|
{
|
||||||
|
Tokens tokens = client.getTokens(grantParams(code)).await().indefinitely();
|
||||||
|
NewCookie cookie = new NewCookie.Builder("session").value(tokens.getAccessToken()).path("/").maxAge((int) (tokens.getAccessTokenExpiresAt() - ZonedDateTime.now().toEpochSecond())).secure(false).httpOnly(true).build();
|
||||||
|
return Response.seeOther(URI.create("http://localhost:3000")).cookie(cookie).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
private Map<String, String> grantParams(String code)
|
||||||
|
{
|
||||||
|
return Map.ofEntries(
|
||||||
|
Map.entry("grant_type", "authorization_code"),
|
||||||
|
Map.entry("code", code),
|
||||||
|
Map.entry("redirect_uri", "redirectUri")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
56
src/main/java/dev/dinauer/maven/TokenIdentityProvider.java
Normal file
56
src/main/java/dev/dinauer/maven/TokenIdentityProvider.java
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
package dev.dinauer.maven;
|
||||||
|
|
||||||
|
import dev.dinauer.maven.maven.token.TokenEntity;
|
||||||
|
import dev.dinauer.maven.maven.token.TokenRepo;
|
||||||
|
import io.quarkus.elytron.security.common.BcryptUtil;
|
||||||
|
import io.quarkus.security.AuthenticationFailedException;
|
||||||
|
import io.quarkus.security.identity.AuthenticationRequestContext;
|
||||||
|
import io.quarkus.security.identity.IdentityProvider;
|
||||||
|
import io.quarkus.security.identity.SecurityIdentity;
|
||||||
|
import io.quarkus.security.identity.request.TokenAuthenticationRequest;
|
||||||
|
import io.quarkus.security.identity.request.UsernamePasswordAuthenticationRequest;
|
||||||
|
import io.quarkus.security.runtime.QuarkusPrincipal;
|
||||||
|
import io.quarkus.security.runtime.QuarkusSecurityIdentity;
|
||||||
|
import io.smallrye.mutiny.Uni;
|
||||||
|
import io.smallrye.mutiny.infrastructure.Infrastructure;
|
||||||
|
import jakarta.enterprise.context.ApplicationScoped;
|
||||||
|
import jakarta.enterprise.context.control.ActivateRequestContext;
|
||||||
|
import jakarta.inject.Inject;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.util.Base64;
|
||||||
|
|
||||||
|
@ApplicationScoped
|
||||||
|
public class TokenIdentityProvider implements IdentityProvider<UsernamePasswordAuthenticationRequest>
|
||||||
|
{
|
||||||
|
@Inject
|
||||||
|
TokenRepo tokenRepo;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<UsernamePasswordAuthenticationRequest> getRequestType()
|
||||||
|
{
|
||||||
|
return UsernamePasswordAuthenticationRequest.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@ActivateRequestContext
|
||||||
|
public Uni<SecurityIdentity> authenticate(UsernamePasswordAuthenticationRequest request, AuthenticationRequestContext authenticationRequestContext)
|
||||||
|
{
|
||||||
|
return Uni.createFrom().item(() -> {
|
||||||
|
String username = request.getUsername();
|
||||||
|
String password = new String(request.getPassword().getPassword());
|
||||||
|
for (TokenEntity token : tokenRepo.findByUserId(username))
|
||||||
|
{
|
||||||
|
if (BcryptUtil.matches(password, token.getToken()))
|
||||||
|
{
|
||||||
|
LocalDate now = LocalDate.now();
|
||||||
|
if (!now.isAfter(token.getExpiresAt()))
|
||||||
|
{
|
||||||
|
return (SecurityIdentity) QuarkusSecurityIdentity.builder().setPrincipal(new QuarkusPrincipal(token.getUserId())).build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new AuthenticationFailedException();
|
||||||
|
}).runSubscriptionOn(Infrastructure.getDefaultWorkerPool());
|
||||||
|
}
|
||||||
|
}
|
||||||
67
src/main/java/dev/dinauer/maven/app/ArtifactResource.java
Normal file
67
src/main/java/dev/dinauer/maven/app/ArtifactResource.java
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
package dev.dinauer.maven.app;
|
||||||
|
|
||||||
|
import dev.dinauer.maven.user.User;
|
||||||
|
import dev.dinauer.maven.jpa.maven.Version;
|
||||||
|
import dev.dinauer.maven.jpa.maven.repo.ArtifactRepo;
|
||||||
|
import dev.dinauer.maven.jpa.maven.ArtifactId;
|
||||||
|
import dev.dinauer.maven.user.UserClient;
|
||||||
|
import jakarta.inject.Inject;
|
||||||
|
import jakarta.ws.rs.GET;
|
||||||
|
import jakarta.ws.rs.Path;
|
||||||
|
import jakarta.ws.rs.PathParam;
|
||||||
|
import org.eclipse.microprofile.rest.client.inject.RestClient;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Path("/artifacts")
|
||||||
|
public class ArtifactResource
|
||||||
|
{
|
||||||
|
@Inject
|
||||||
|
ArtifactRepo artifactRepo;
|
||||||
|
|
||||||
|
@RestClient
|
||||||
|
UserClient userClient;
|
||||||
|
|
||||||
|
@GET
|
||||||
|
public List<ArtifactId> get()
|
||||||
|
{
|
||||||
|
return find();
|
||||||
|
}
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("/{id}")
|
||||||
|
public ArtifactId getById(@PathParam("id") String id)
|
||||||
|
{
|
||||||
|
return artifactRepo.findById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<ArtifactId> find()
|
||||||
|
{
|
||||||
|
List<ArtifactId> artifactIds = artifactRepo.listAll();
|
||||||
|
Map<String, User> accounts = getAccounts(artifactIds);
|
||||||
|
for (ArtifactId artifactId : artifactIds)
|
||||||
|
{
|
||||||
|
for (Version version : artifactId.getVersions())
|
||||||
|
{
|
||||||
|
version.setUploadAccount(accounts.get(version.getUploadedBy()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return artifactIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Map<String, User> getAccounts(List<ArtifactId> artifactIds)
|
||||||
|
{
|
||||||
|
List<String> ids = new ArrayList<>();
|
||||||
|
for (ArtifactId artifactId : artifactIds)
|
||||||
|
{
|
||||||
|
for (Version version : artifactId.getVersions())
|
||||||
|
{
|
||||||
|
ids.add(version.getUploadedBy());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return userClient.get(ids);
|
||||||
|
}
|
||||||
|
}
|
||||||
56
src/main/java/dev/dinauer/maven/app/EventsResource.java
Normal file
56
src/main/java/dev/dinauer/maven/app/EventsResource.java
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
package dev.dinauer.maven.app;
|
||||||
|
|
||||||
|
import dev.dinauer.maven.user.User;
|
||||||
|
import dev.dinauer.maven.jpa.events.Event;
|
||||||
|
import dev.dinauer.maven.jpa.events.repo.EventRepo;
|
||||||
|
import dev.dinauer.maven.user.UserClient;
|
||||||
|
import io.quarkus.panache.common.Sort;
|
||||||
|
import io.quarkus.security.Authenticated;
|
||||||
|
import jakarta.inject.Inject;
|
||||||
|
import jakarta.ws.rs.GET;
|
||||||
|
import jakarta.ws.rs.Path;
|
||||||
|
import jakarta.ws.rs.core.SecurityContext;
|
||||||
|
import org.eclipse.microprofile.rest.client.inject.RestClient;
|
||||||
|
|
||||||
|
import java.security.Principal;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Path("/events")
|
||||||
|
public class EventsResource
|
||||||
|
{
|
||||||
|
@Inject
|
||||||
|
EventRepo eventRepo;
|
||||||
|
|
||||||
|
@RestClient
|
||||||
|
UserClient userClient;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
SecurityContext context;
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Authenticated
|
||||||
|
public List<Event> get()
|
||||||
|
{
|
||||||
|
return find(eventRepo.listAll(Sort.by("timestamp", Sort.Direction.Descending)));
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<Event> find(List<Event> events)
|
||||||
|
{
|
||||||
|
Principal c = context.getUserPrincipal();
|
||||||
|
List<String> ids = new ArrayList<>();
|
||||||
|
for (Event event : events)
|
||||||
|
{
|
||||||
|
ids.add(event.getAccountId());
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, User> accounts = userClient.get(ids);
|
||||||
|
|
||||||
|
for (Event event : events)
|
||||||
|
{
|
||||||
|
event.setAccount(accounts.get(event.getAccountId()));
|
||||||
|
}
|
||||||
|
return events;
|
||||||
|
}
|
||||||
|
}
|
||||||
22
src/main/java/dev/dinauer/maven/app/GroupResource.java
Normal file
22
src/main/java/dev/dinauer/maven/app/GroupResource.java
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
package dev.dinauer.maven.app;
|
||||||
|
|
||||||
|
import dev.dinauer.maven.jpa.maven.repo.GroupRepo;
|
||||||
|
import dev.dinauer.maven.jpa.maven.GroupId;
|
||||||
|
import jakarta.inject.Inject;
|
||||||
|
import jakarta.ws.rs.GET;
|
||||||
|
import jakarta.ws.rs.Path;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Path("/groups")
|
||||||
|
public class GroupResource
|
||||||
|
{
|
||||||
|
@Inject
|
||||||
|
GroupRepo groupRepo;
|
||||||
|
|
||||||
|
@GET
|
||||||
|
public List<GroupId> get()
|
||||||
|
{
|
||||||
|
return groupRepo.listAll();
|
||||||
|
}
|
||||||
|
}
|
||||||
98
src/main/java/dev/dinauer/maven/jpa/events/Event.java
Normal file
98
src/main/java/dev/dinauer/maven/jpa/events/Event.java
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
package dev.dinauer.maven.jpa.events;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonManagedReference;
|
||||||
|
import dev.dinauer.maven.user.User;
|
||||||
|
import jakarta.persistence.*;
|
||||||
|
|
||||||
|
import java.time.ZonedDateTime;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(name = "event")
|
||||||
|
public class Event
|
||||||
|
{
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.UUID)
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@Enumerated(EnumType.STRING)
|
||||||
|
private EventType type;
|
||||||
|
|
||||||
|
@OneToOne(cascade = CascadeType.ALL)
|
||||||
|
@JoinColumn(name = "resource_id")
|
||||||
|
@JsonManagedReference
|
||||||
|
private Resource resource;
|
||||||
|
|
||||||
|
private ZonedDateTime timestamp;
|
||||||
|
|
||||||
|
@Column(name = "accountId")
|
||||||
|
private String accountId;
|
||||||
|
|
||||||
|
@Transient
|
||||||
|
private User user;
|
||||||
|
|
||||||
|
public String getId()
|
||||||
|
{
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Event setId(String id)
|
||||||
|
{
|
||||||
|
this.id = id;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Resource getResource()
|
||||||
|
{
|
||||||
|
return resource;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Event setResource(Resource resource)
|
||||||
|
{
|
||||||
|
this.resource = resource;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ZonedDateTime getTimestamp()
|
||||||
|
{
|
||||||
|
return timestamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Event setTimestamp(ZonedDateTime timestamp)
|
||||||
|
{
|
||||||
|
this.timestamp = timestamp;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EventType getType()
|
||||||
|
{
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Event setType(EventType type)
|
||||||
|
{
|
||||||
|
this.type = type;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAccountId()
|
||||||
|
{
|
||||||
|
return accountId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Event setAccountId(String userId)
|
||||||
|
{
|
||||||
|
this.accountId = userId;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public User getAccount()
|
||||||
|
{
|
||||||
|
return user;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Event setAccount(User user)
|
||||||
|
{
|
||||||
|
this.user = user;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,6 @@
|
|||||||
|
package dev.dinauer.maven.jpa.events;
|
||||||
|
|
||||||
|
public enum EventType
|
||||||
|
{
|
||||||
|
UPLOAD, DELETE
|
||||||
|
}
|
||||||
80
src/main/java/dev/dinauer/maven/jpa/events/Resource.java
Normal file
80
src/main/java/dev/dinauer/maven/jpa/events/Resource.java
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
package dev.dinauer.maven.jpa.events;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonBackReference;
|
||||||
|
import jakarta.persistence.*;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(name = "resource")
|
||||||
|
public class Resource
|
||||||
|
{
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.UUID)
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@Column(name = "group_id")
|
||||||
|
private String groupId;
|
||||||
|
|
||||||
|
@Column(name = "artifact_id")
|
||||||
|
private String artifactId;
|
||||||
|
|
||||||
|
private String version;
|
||||||
|
|
||||||
|
@OneToOne(mappedBy = "resource")
|
||||||
|
@JsonBackReference
|
||||||
|
private Event event;
|
||||||
|
|
||||||
|
public String getId()
|
||||||
|
{
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Resource setId(String id)
|
||||||
|
{
|
||||||
|
this.id = id;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGroupId()
|
||||||
|
{
|
||||||
|
return groupId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Resource setGroupId(String groupId)
|
||||||
|
{
|
||||||
|
this.groupId = groupId;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getArtifactId()
|
||||||
|
{
|
||||||
|
return artifactId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Resource setArtifactId(String artifactId)
|
||||||
|
{
|
||||||
|
this.artifactId = artifactId;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getVersion()
|
||||||
|
{
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Resource setVersion(String version)
|
||||||
|
{
|
||||||
|
this.version = version;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Event getEvent()
|
||||||
|
{
|
||||||
|
return event;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Resource setEvent(Event event)
|
||||||
|
{
|
||||||
|
this.event = event;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
package dev.dinauer.maven.jpa.events.repo;
|
||||||
|
|
||||||
|
import dev.dinauer.maven.jpa.events.Event;
|
||||||
|
import io.quarkus.hibernate.orm.panache.PanacheRepositoryBase;
|
||||||
|
import jakarta.enterprise.context.ApplicationScoped;
|
||||||
|
|
||||||
|
@ApplicationScoped
|
||||||
|
public class EventRepo implements PanacheRepositoryBase<Event, String>
|
||||||
|
{
|
||||||
|
}
|
||||||
129
src/main/java/dev/dinauer/maven/jpa/maven/ArtifactId.java
Normal file
129
src/main/java/dev/dinauer/maven/jpa/maven/ArtifactId.java
Normal file
@ -0,0 +1,129 @@
|
|||||||
|
package dev.dinauer.maven.jpa.maven;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonBackReference;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonManagedReference;
|
||||||
|
import jakarta.persistence.*;
|
||||||
|
import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
|
||||||
|
|
||||||
|
import java.time.ZonedDateTime;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(name = "artifact_id")
|
||||||
|
public class ArtifactId
|
||||||
|
{
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.UUID)
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@Column(name = "group_id_long")
|
||||||
|
private String groupId;
|
||||||
|
|
||||||
|
@Column(name = "artifact_id")
|
||||||
|
private String artifactId;
|
||||||
|
|
||||||
|
@ManyToOne(cascade = CascadeType.ALL)
|
||||||
|
@JoinColumn(name = "group_id")
|
||||||
|
@JsonBackReference
|
||||||
|
private GroupId group;
|
||||||
|
|
||||||
|
@OneToMany(mappedBy = "artifact")
|
||||||
|
@JsonManagedReference
|
||||||
|
private List<Version> versions = new ArrayList<>();
|
||||||
|
|
||||||
|
@Column(name = "updated_at")
|
||||||
|
private ZonedDateTime updatedAt;
|
||||||
|
|
||||||
|
@Column(name = "created_at")
|
||||||
|
private ZonedDateTime createdAt;
|
||||||
|
|
||||||
|
public String getId()
|
||||||
|
{
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArtifactId setId(String id)
|
||||||
|
{
|
||||||
|
this.id = id;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGroupId()
|
||||||
|
{
|
||||||
|
return groupId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArtifactId setGroupId(String groupId)
|
||||||
|
{
|
||||||
|
this.groupId = groupId;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getArtifactId()
|
||||||
|
{
|
||||||
|
return artifactId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArtifactId setArtifactId(String artifactId)
|
||||||
|
{
|
||||||
|
this.artifactId = artifactId;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GroupId getGroup()
|
||||||
|
{
|
||||||
|
return group;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArtifactId setGroup(GroupId groupId)
|
||||||
|
{
|
||||||
|
this.group = groupId;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Version> getVersions()
|
||||||
|
{
|
||||||
|
return versions.stream().sorted(Comparator.comparing(version -> new DefaultArtifactVersion(version.getVersion()))).toList().reversed();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArtifactId setVersions(List<Version> versions)
|
||||||
|
{
|
||||||
|
this.versions = versions;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ZonedDateTime getUpdatedAt()
|
||||||
|
{
|
||||||
|
return updatedAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArtifactId setUpdatedAt(ZonedDateTime updatedAt)
|
||||||
|
{
|
||||||
|
this.updatedAt = updatedAt;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ZonedDateTime getCreatedAt()
|
||||||
|
{
|
||||||
|
return createdAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArtifactId setCreatedAt(ZonedDateTime createdAt)
|
||||||
|
{
|
||||||
|
this.createdAt = createdAt;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getTotalPullCount()
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
for (Version version : versions)
|
||||||
|
{
|
||||||
|
i = i + version.getPullCount();
|
||||||
|
}
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
85
src/main/java/dev/dinauer/maven/jpa/maven/GroupId.java
Normal file
85
src/main/java/dev/dinauer/maven/jpa/maven/GroupId.java
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
package dev.dinauer.maven.jpa.maven;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonManagedReference;
|
||||||
|
import jakarta.persistence.*;
|
||||||
|
|
||||||
|
import java.time.ZonedDateTime;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(name = "group_id")
|
||||||
|
public class GroupId
|
||||||
|
{
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.UUID)
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@Column(name = "group_id")
|
||||||
|
private String groupId;
|
||||||
|
|
||||||
|
@OneToMany(mappedBy = "group")
|
||||||
|
@JsonManagedReference
|
||||||
|
private List<ArtifactId> artifacts = new ArrayList<>();
|
||||||
|
|
||||||
|
@Column(name = "updated_at")
|
||||||
|
private ZonedDateTime updatedAt;
|
||||||
|
|
||||||
|
@Column(name = "created_at")
|
||||||
|
private ZonedDateTime createdAt;
|
||||||
|
|
||||||
|
public String getId()
|
||||||
|
{
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GroupId setId(String id)
|
||||||
|
{
|
||||||
|
this.id = id;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGroupId()
|
||||||
|
{
|
||||||
|
return groupId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GroupId setGroupId(String groupId)
|
||||||
|
{
|
||||||
|
this.groupId = groupId;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ArtifactId> getArtifacts()
|
||||||
|
{
|
||||||
|
return artifacts;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GroupId setArtifacts(List<ArtifactId> artifactIds)
|
||||||
|
{
|
||||||
|
this.artifacts = artifactIds;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ZonedDateTime getUpdatedAt()
|
||||||
|
{
|
||||||
|
return updatedAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GroupId setUpdatedAt(ZonedDateTime updatedAt)
|
||||||
|
{
|
||||||
|
this.updatedAt = updatedAt;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ZonedDateTime getCreatedAt()
|
||||||
|
{
|
||||||
|
return createdAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GroupId setCreatedAt(ZonedDateTime createdAt)
|
||||||
|
{
|
||||||
|
this.createdAt = createdAt;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
109
src/main/java/dev/dinauer/maven/jpa/maven/Jar.java
Normal file
109
src/main/java/dev/dinauer/maven/jpa/maven/Jar.java
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
package dev.dinauer.maven.jpa.maven;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonBackReference;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
|
import jakarta.persistence.*;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(name = "jar")
|
||||||
|
public class Jar
|
||||||
|
{
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.UUID)
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@Column(columnDefinition = "bytea")
|
||||||
|
@JsonIgnore
|
||||||
|
@Basic(fetch = FetchType.LAZY)
|
||||||
|
private byte[] jar;
|
||||||
|
|
||||||
|
private String md5;
|
||||||
|
|
||||||
|
private String sha1;
|
||||||
|
|
||||||
|
private String url;
|
||||||
|
|
||||||
|
private String filename;
|
||||||
|
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "version_id")
|
||||||
|
@JsonBackReference
|
||||||
|
private Version version;
|
||||||
|
|
||||||
|
public String getId()
|
||||||
|
{
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Jar setId(String id)
|
||||||
|
{
|
||||||
|
this.id = id;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte[] getJar()
|
||||||
|
{
|
||||||
|
return jar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Jar setJar(byte[] jar)
|
||||||
|
{
|
||||||
|
this.jar = jar;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMd5()
|
||||||
|
{
|
||||||
|
return md5;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Jar setMd5(String md5)
|
||||||
|
{
|
||||||
|
this.md5 = md5;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSha1()
|
||||||
|
{
|
||||||
|
return sha1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Jar setSha1(String sha1)
|
||||||
|
{
|
||||||
|
this.sha1 = sha1;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Version getVersion()
|
||||||
|
{
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Jar setVersion(Version version)
|
||||||
|
{
|
||||||
|
this.version = version;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUrl()
|
||||||
|
{
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Jar setUrl(String url)
|
||||||
|
{
|
||||||
|
this.url = url;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFilename()
|
||||||
|
{
|
||||||
|
return filename;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Jar setFilename(String filename)
|
||||||
|
{
|
||||||
|
this.filename = filename;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
109
src/main/java/dev/dinauer/maven/jpa/maven/Pom.java
Normal file
109
src/main/java/dev/dinauer/maven/jpa/maven/Pom.java
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
package dev.dinauer.maven.jpa.maven;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonBackReference;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
|
import jakarta.persistence.*;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(name = "pom")
|
||||||
|
public class Pom
|
||||||
|
{
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.UUID)
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
|
@Column(columnDefinition = "TEXT")
|
||||||
|
@Basic(fetch = FetchType.LAZY)
|
||||||
|
private String pom;
|
||||||
|
|
||||||
|
private String md5;
|
||||||
|
|
||||||
|
private String sha1;
|
||||||
|
|
||||||
|
private String url;
|
||||||
|
|
||||||
|
private String filename;
|
||||||
|
|
||||||
|
@OneToOne
|
||||||
|
@JoinColumn(name = "version_id")
|
||||||
|
@JsonBackReference
|
||||||
|
private Version version;
|
||||||
|
|
||||||
|
public String getId()
|
||||||
|
{
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Pom setId(String id)
|
||||||
|
{
|
||||||
|
this.id = id;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPom()
|
||||||
|
{
|
||||||
|
return pom;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Pom setPom(String pom)
|
||||||
|
{
|
||||||
|
this.pom = pom;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMd5()
|
||||||
|
{
|
||||||
|
return md5;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Pom setMd5(String md5)
|
||||||
|
{
|
||||||
|
this.md5 = md5;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSha1()
|
||||||
|
{
|
||||||
|
return sha1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Pom setSha1(String sha1)
|
||||||
|
{
|
||||||
|
this.sha1 = sha1;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Version getVersion()
|
||||||
|
{
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Pom setVersion(Version version)
|
||||||
|
{
|
||||||
|
this.version = version;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUrl()
|
||||||
|
{
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Pom setUrl(String url)
|
||||||
|
{
|
||||||
|
this.url = url;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFilename()
|
||||||
|
{
|
||||||
|
return filename;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Pom setFilename(String filename)
|
||||||
|
{
|
||||||
|
this.filename = filename;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
191
src/main/java/dev/dinauer/maven/jpa/maven/Version.java
Normal file
191
src/main/java/dev/dinauer/maven/jpa/maven/Version.java
Normal file
@ -0,0 +1,191 @@
|
|||||||
|
package dev.dinauer.maven.jpa.maven;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonBackReference;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonManagedReference;
|
||||||
|
import dev.dinauer.maven.user.User;
|
||||||
|
import jakarta.persistence.*;
|
||||||
|
|
||||||
|
import java.time.ZonedDateTime;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(name = "version")
|
||||||
|
public class Version
|
||||||
|
{
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.UUID)
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@Column(name = "group_id_long")
|
||||||
|
private String groupId;
|
||||||
|
|
||||||
|
@Column(name = "artifact_id_long")
|
||||||
|
private String artifactId;
|
||||||
|
|
||||||
|
private String version;
|
||||||
|
|
||||||
|
@ManyToOne(cascade = CascadeType.ALL)
|
||||||
|
@JoinColumn(name = "artifact_id")
|
||||||
|
@JsonBackReference
|
||||||
|
private ArtifactId artifact;
|
||||||
|
|
||||||
|
@OneToMany(mappedBy = "version", cascade = CascadeType.ALL)
|
||||||
|
@JsonManagedReference
|
||||||
|
private List<Jar> jars = new ArrayList<>();
|
||||||
|
|
||||||
|
@OneToOne(mappedBy = "version", cascade = CascadeType.ALL)
|
||||||
|
@JsonManagedReference
|
||||||
|
private Pom pom;
|
||||||
|
|
||||||
|
@Column(name = "last_pulled")
|
||||||
|
private ZonedDateTime lastPulled;
|
||||||
|
|
||||||
|
@Column(name = "pull_count")
|
||||||
|
private int pullCount = 0;
|
||||||
|
|
||||||
|
@Column(name = "uploaded_by")
|
||||||
|
private String uploadedBy;
|
||||||
|
|
||||||
|
@Transient
|
||||||
|
private User uploadUser;
|
||||||
|
|
||||||
|
public String getId()
|
||||||
|
{
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Version setId(String id)
|
||||||
|
{
|
||||||
|
this.id = id;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGroupId()
|
||||||
|
{
|
||||||
|
return groupId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Version setGroupId(String groupId)
|
||||||
|
{
|
||||||
|
this.groupId = groupId;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getArtifactId()
|
||||||
|
{
|
||||||
|
return artifactId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Version setArtifactId(String artifactId)
|
||||||
|
{
|
||||||
|
this.artifactId = artifactId;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getVersion()
|
||||||
|
{
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Version setVersion(String version)
|
||||||
|
{
|
||||||
|
this.version = version;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArtifactId getArtifact()
|
||||||
|
{
|
||||||
|
return artifact;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Version setArtifact(ArtifactId artifactId)
|
||||||
|
{
|
||||||
|
this.artifact = artifactId;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Jar> getJars()
|
||||||
|
{
|
||||||
|
return jars;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Version setJars(List<Jar> jars)
|
||||||
|
{
|
||||||
|
this.jars = jars;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Pom getPom()
|
||||||
|
{
|
||||||
|
return pom;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Version setPom(Pom pom)
|
||||||
|
{
|
||||||
|
this.pom = pom;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ZonedDateTime getLastPulled()
|
||||||
|
{
|
||||||
|
return lastPulled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Version setLastPulled(ZonedDateTime lastPulled)
|
||||||
|
{
|
||||||
|
this.lastPulled = lastPulled;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUploadedBy()
|
||||||
|
{
|
||||||
|
return uploadedBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Version setUploadedBy(String uploadedBy)
|
||||||
|
{
|
||||||
|
this.uploadedBy = uploadedBy;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public User getUploadAccount()
|
||||||
|
{
|
||||||
|
return uploadUser;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Version setUploadAccount(User uploadUser)
|
||||||
|
{
|
||||||
|
this.uploadUser = uploadUser;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPullCount()
|
||||||
|
{
|
||||||
|
return pullCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Version setPullCount(int pullCount)
|
||||||
|
{
|
||||||
|
this.pullCount = pullCount;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void incrementPullCount()
|
||||||
|
{
|
||||||
|
pullCount = pullCount + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Optional<Jar> getJarByFilename(String filename)
|
||||||
|
{
|
||||||
|
for (Jar jar : jars)
|
||||||
|
{
|
||||||
|
if (jar.getFilename().equals(filename))
|
||||||
|
{
|
||||||
|
return Optional.of(jar);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,17 @@
|
|||||||
|
package dev.dinauer.maven.jpa.maven.repo;
|
||||||
|
|
||||||
|
import dev.dinauer.maven.jpa.maven.ArtifactId;
|
||||||
|
import io.quarkus.hibernate.orm.panache.PanacheRepositoryBase;
|
||||||
|
import io.quarkus.panache.common.Parameters;
|
||||||
|
import jakarta.enterprise.context.ApplicationScoped;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
@ApplicationScoped
|
||||||
|
public class ArtifactRepo implements PanacheRepositoryBase<ArtifactId, String>
|
||||||
|
{
|
||||||
|
public Optional<ArtifactId> findOptionalByArtifactId(String groupId, String artifactId)
|
||||||
|
{
|
||||||
|
return find("artifactId = :artifactId AND group.groupId = :groupId", Parameters.with("groupId", groupId).and("artifactId", artifactId)).firstResultOptional();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,17 @@
|
|||||||
|
package dev.dinauer.maven.jpa.maven.repo;
|
||||||
|
|
||||||
|
import dev.dinauer.maven.jpa.maven.GroupId;
|
||||||
|
import io.quarkus.hibernate.orm.panache.PanacheRepositoryBase;
|
||||||
|
import io.quarkus.panache.common.Parameters;
|
||||||
|
import jakarta.enterprise.context.ApplicationScoped;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
@ApplicationScoped
|
||||||
|
public class GroupRepo implements PanacheRepositoryBase<GroupId, String>
|
||||||
|
{
|
||||||
|
public Optional<GroupId> findOptionalByGroupId(String groupId)
|
||||||
|
{
|
||||||
|
return find("groupId = :groupId", Parameters.with("groupId", groupId)).firstResultOptional();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,17 @@
|
|||||||
|
package dev.dinauer.maven.jpa.maven.repo;
|
||||||
|
|
||||||
|
import dev.dinauer.maven.jpa.maven.Version;
|
||||||
|
import io.quarkus.hibernate.orm.panache.PanacheRepositoryBase;
|
||||||
|
import io.quarkus.panache.common.Parameters;
|
||||||
|
import jakarta.enterprise.context.ApplicationScoped;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
@ApplicationScoped
|
||||||
|
public class VersionRepo implements PanacheRepositoryBase<Version, String>
|
||||||
|
{
|
||||||
|
public Optional<Version> findOptionalByVersion(String groupId, String artifactId, String version)
|
||||||
|
{
|
||||||
|
return find("version = :version AND artifact.artifactId = :artifactId AND artifact.group.groupId = :groupId", Parameters.with("groupId", groupId).and("artifactId", artifactId).and("version", version)).firstResultOptional();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,40 @@
|
|||||||
|
package dev.dinauer.maven.maven.core;
|
||||||
|
|
||||||
|
import dev.dinauer.maven.jpa.maven.ArtifactId;
|
||||||
|
import dev.dinauer.maven.jpa.maven.GroupId;
|
||||||
|
import dev.dinauer.maven.jpa.maven.repo.ArtifactRepo;
|
||||||
|
import jakarta.enterprise.context.ApplicationScoped;
|
||||||
|
import jakarta.inject.Inject;
|
||||||
|
|
||||||
|
import java.time.ZonedDateTime;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
@ApplicationScoped
|
||||||
|
public class ArtifactService
|
||||||
|
{
|
||||||
|
@Inject
|
||||||
|
ArtifactRepo artifactRepo;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
GroupService groupService;
|
||||||
|
|
||||||
|
public ArtifactId findOrCreate(String groupId, String artifactId)
|
||||||
|
{
|
||||||
|
Optional<ArtifactId> artifactOptional = artifactRepo.findOptionalByArtifactId(groupId, artifactId);
|
||||||
|
if (artifactOptional.isPresent())
|
||||||
|
{
|
||||||
|
return artifactOptional.get();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GroupId group = groupService.findOrCreate(groupId);
|
||||||
|
group.setUpdatedAt(ZonedDateTime.now());
|
||||||
|
return new ArtifactId().setArtifactId(artifactId).setGroup(group).setGroupId(groupId).setCreatedAt(ZonedDateTime.now());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Optional<ArtifactId> find(String groupId, String artifactId)
|
||||||
|
{
|
||||||
|
return artifactRepo.findOptionalByArtifactId(groupId, artifactId);
|
||||||
|
}
|
||||||
|
}
|
||||||
29
src/main/java/dev/dinauer/maven/maven/core/GroupService.java
Normal file
29
src/main/java/dev/dinauer/maven/maven/core/GroupService.java
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
package dev.dinauer.maven.maven.core;
|
||||||
|
|
||||||
|
import dev.dinauer.maven.jpa.maven.GroupId;
|
||||||
|
import dev.dinauer.maven.jpa.maven.repo.GroupRepo;
|
||||||
|
import jakarta.enterprise.context.ApplicationScoped;
|
||||||
|
import jakarta.inject.Inject;
|
||||||
|
|
||||||
|
import java.time.ZonedDateTime;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
@ApplicationScoped
|
||||||
|
public class GroupService
|
||||||
|
{
|
||||||
|
@Inject
|
||||||
|
GroupRepo groupRepo;
|
||||||
|
|
||||||
|
public GroupId findOrCreate(String groupId)
|
||||||
|
{
|
||||||
|
Optional<GroupId> group = groupRepo.findOptionalByGroupId(groupId);
|
||||||
|
if (group.isPresent())
|
||||||
|
{
|
||||||
|
return group.get();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return new GroupId().setGroupId(groupId).setCreatedAt(ZonedDateTime.now());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,28 @@
|
|||||||
|
package dev.dinauer.maven.maven.core;
|
||||||
|
|
||||||
|
import dev.dinauer.maven.maven.core.model.File;
|
||||||
|
import dev.dinauer.maven.maven.core.model.MavenContext;
|
||||||
|
|
||||||
|
import java.nio.file.Path;
|
||||||
|
|
||||||
|
public class MavenContextProvider
|
||||||
|
{
|
||||||
|
public static MavenContext parse(String path)
|
||||||
|
{
|
||||||
|
File file = File.parse(Path.of(path).getFileName().toString());
|
||||||
|
switch (file.getType())
|
||||||
|
{
|
||||||
|
case JAR, POM ->
|
||||||
|
{
|
||||||
|
MavenUrlParser parser = MavenUrlParser.parse(path);
|
||||||
|
return new MavenContext(parser.groupId(), parser.artifactId(), parser.version(), file);
|
||||||
|
}
|
||||||
|
case XML ->
|
||||||
|
{
|
||||||
|
MavenMetadataUrlParser parser = MavenMetadataUrlParser.parse(path);
|
||||||
|
return new MavenContext(parser.groupId(), parser.artifactId(), null, file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new RuntimeException();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,46 @@
|
|||||||
|
package dev.dinauer.maven.maven.core;
|
||||||
|
|
||||||
|
import jakarta.ws.rs.BadRequestException;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
public class MavenMetadataUrlParser
|
||||||
|
{
|
||||||
|
private final String path;
|
||||||
|
|
||||||
|
private MavenMetadataUrlParser(String path)
|
||||||
|
{
|
||||||
|
this.path = path;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MavenMetadataUrlParser parse(String path)
|
||||||
|
{
|
||||||
|
return new MavenMetadataUrlParser(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String groupId()
|
||||||
|
{
|
||||||
|
List<String> sections = getSections(path);
|
||||||
|
return String.join(".", sections.subList(0, sections.size() - 2));
|
||||||
|
}
|
||||||
|
|
||||||
|
public String artifactId()
|
||||||
|
{
|
||||||
|
List<String> sections = getSections(path);
|
||||||
|
return sections.get(sections.size() - 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getSections(String path)
|
||||||
|
{
|
||||||
|
String[] sections = path.split("/");
|
||||||
|
if (sections.length > 3)
|
||||||
|
{
|
||||||
|
return Stream.of(sections).filter(section -> !section.isBlank()).toList();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new BadRequestException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,54 @@
|
|||||||
|
package dev.dinauer.maven.maven.core;
|
||||||
|
|
||||||
|
import dev.dinauer.maven.maven.core.model.Version;
|
||||||
|
import jakarta.ws.rs.BadRequestException;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
public class MavenUrlParser
|
||||||
|
{
|
||||||
|
private final String path;
|
||||||
|
|
||||||
|
private MavenUrlParser(String path)
|
||||||
|
{
|
||||||
|
this.path = path;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MavenUrlParser parse(String path)
|
||||||
|
{
|
||||||
|
return new MavenUrlParser(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String groupId()
|
||||||
|
{
|
||||||
|
List<String> sections = getSections(path);
|
||||||
|
return String.join(".", sections.subList(0, sections.size() - 3));
|
||||||
|
}
|
||||||
|
|
||||||
|
public String artifactId()
|
||||||
|
{
|
||||||
|
List<String> sections = getSections(path);
|
||||||
|
return sections.get(sections.size() - 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Version version()
|
||||||
|
{
|
||||||
|
List<String> sections = getSections(path);
|
||||||
|
String raw = sections.get(sections.size() - 2);
|
||||||
|
return new Version().setRaw(raw).setSnapshot(raw.endsWith("-SNAPSHOT"));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static List<String> getSections(String path)
|
||||||
|
{
|
||||||
|
String[] sections = path.split("/");
|
||||||
|
if (sections.length > 3)
|
||||||
|
{
|
||||||
|
return Stream.of(sections).filter(section -> !section.isBlank()).toList();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new BadRequestException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
30
src/main/java/dev/dinauer/maven/maven/core/Resource.java
Normal file
30
src/main/java/dev/dinauer/maven/maven/core/Resource.java
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
package dev.dinauer.maven.maven.core;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
import io.quarkus.security.Authenticated;
|
||||||
|
import jakarta.inject.Inject;
|
||||||
|
import jakarta.ws.rs.*;
|
||||||
|
import jakarta.ws.rs.core.Response;
|
||||||
|
|
||||||
|
|
||||||
|
@Path("/maven2")
|
||||||
|
@Authenticated
|
||||||
|
public class Resource
|
||||||
|
{
|
||||||
|
@Inject
|
||||||
|
Service service;
|
||||||
|
|
||||||
|
@PUT
|
||||||
|
@Path("/{path: .*}")
|
||||||
|
public Response put(@PathParam("path") String path, byte[] body)
|
||||||
|
{
|
||||||
|
return service.upload(path, body);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("/{path: .*}")
|
||||||
|
public Response get(@PathParam("path") String path) throws JsonProcessingException
|
||||||
|
{
|
||||||
|
return service.serve(path);
|
||||||
|
}
|
||||||
|
}
|
||||||
142
src/main/java/dev/dinauer/maven/maven/core/Service.java
Normal file
142
src/main/java/dev/dinauer/maven/maven/core/Service.java
Normal file
@ -0,0 +1,142 @@
|
|||||||
|
package dev.dinauer.maven.maven.core;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
|
||||||
|
import dev.dinauer.maven.jpa.maven.ArtifactId;
|
||||||
|
import dev.dinauer.maven.jpa.maven.Jar;
|
||||||
|
import dev.dinauer.maven.jpa.maven.Pom;
|
||||||
|
import dev.dinauer.maven.jpa.maven.Version;
|
||||||
|
import dev.dinauer.maven.maven.token.TokenService;
|
||||||
|
import dev.dinauer.maven.metadata.Metadata;
|
||||||
|
import dev.dinauer.maven.maven.core.model.FileHash;
|
||||||
|
import dev.dinauer.maven.maven.core.model.MavenContext;
|
||||||
|
import jakarta.enterprise.context.ApplicationScoped;
|
||||||
|
import jakarta.inject.Inject;
|
||||||
|
import jakarta.transaction.Transactional;
|
||||||
|
import jakarta.ws.rs.NotFoundException;
|
||||||
|
import jakarta.ws.rs.core.MediaType;
|
||||||
|
import jakarta.ws.rs.core.Response;
|
||||||
|
import org.apache.commons.codec.digest.DigestUtils;
|
||||||
|
|
||||||
|
import java.time.ZonedDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
@ApplicationScoped
|
||||||
|
public class Service
|
||||||
|
{
|
||||||
|
@Inject
|
||||||
|
VersionService versionService;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
ArtifactService artifactService;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
TokenService tokenService;
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public Response upload(String path, byte[] body)
|
||||||
|
{
|
||||||
|
MavenContext mavenContext = MavenContextProvider.parse(path);
|
||||||
|
switch (mavenContext.file().getType())
|
||||||
|
{
|
||||||
|
case JAR ->
|
||||||
|
{
|
||||||
|
if (FileHash.NONE.equals(mavenContext.file().getHash()))
|
||||||
|
{
|
||||||
|
String md5 = DigestUtils.md5Hex(body);
|
||||||
|
String sha1 = DigestUtils.sha1Hex(body);
|
||||||
|
Version version = versionService.findOrCreate(mavenContext.groupId(), mavenContext.artifactId(), mavenContext.version().getRaw());
|
||||||
|
version.getJars().add(new Jar().setJar(body).setMd5(md5).setSha1(sha1).setVersion(version).setUrl(path).setFilename(mavenContext.file().getRaw()));
|
||||||
|
versionService.persist(version);
|
||||||
|
return Response.status(Response.Status.CREATED).build();
|
||||||
|
}
|
||||||
|
return Response.accepted().build();
|
||||||
|
}
|
||||||
|
case POM ->
|
||||||
|
{
|
||||||
|
if (FileHash.NONE.equals(mavenContext.file().getHash()))
|
||||||
|
{
|
||||||
|
String md5 = DigestUtils.md5Hex(body);
|
||||||
|
String sha1 = DigestUtils.sha1Hex(body);
|
||||||
|
Version version = versionService.findOrCreate(mavenContext.groupId(), mavenContext.artifactId(), mavenContext.version().getRaw());
|
||||||
|
version.setUploadedBy(tokenService.require());
|
||||||
|
if (version.getPom() == null)
|
||||||
|
{
|
||||||
|
version.setPom(new Pom().setPom(new String(body)).setMd5(md5).setSha1(sha1).setVersion(version).setUrl(path).setFilename(mavenContext.file().getRaw()));
|
||||||
|
versionService.persist(version);
|
||||||
|
return Response.status(Response.Status.CREATED).build();
|
||||||
|
}
|
||||||
|
return Response.status(Response.Status.CONFLICT).build();
|
||||||
|
}
|
||||||
|
return Response.accepted().build();
|
||||||
|
}
|
||||||
|
case XML ->
|
||||||
|
{
|
||||||
|
return Response.accepted().build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new RuntimeException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public Response serve(String path) throws JsonProcessingException
|
||||||
|
{
|
||||||
|
MavenContext mavenContext = MavenContextProvider.parse(path);
|
||||||
|
switch (mavenContext.file().getType())
|
||||||
|
{
|
||||||
|
case JAR ->
|
||||||
|
{
|
||||||
|
Version version = versionService.findOptional(mavenContext.groupId(), mavenContext.artifactId(), mavenContext.version().getRaw()).orElseThrow();
|
||||||
|
Optional<Jar> optionalJar = version.getJarByFilename(mavenContext.file().getRaw());
|
||||||
|
if (optionalJar.isEmpty())
|
||||||
|
{
|
||||||
|
throw new NotFoundException();
|
||||||
|
}
|
||||||
|
switch (mavenContext.file().getHash())
|
||||||
|
{
|
||||||
|
case SHA1 ->
|
||||||
|
{
|
||||||
|
return Response.status(Response.Status.OK).type(MediaType.APPLICATION_OCTET_STREAM).entity(optionalJar.get().getSha1()).build();
|
||||||
|
}
|
||||||
|
case MD5 ->
|
||||||
|
{
|
||||||
|
return Response.status(Response.Status.OK).type(MediaType.APPLICATION_OCTET_STREAM).entity(optionalJar.get().getMd5()).build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
version.setLastPulled(ZonedDateTime.now());
|
||||||
|
return Response.status(Response.Status.OK).type(MediaType.APPLICATION_OCTET_STREAM).entity(optionalJar.get().getJar()).build();
|
||||||
|
}
|
||||||
|
case POM ->
|
||||||
|
{
|
||||||
|
Version version = versionService.findOptional(mavenContext.groupId(), mavenContext.artifactId(), mavenContext.version().getRaw()).orElseThrow();
|
||||||
|
version.setLastPulled(ZonedDateTime.now());
|
||||||
|
version.incrementPullCount();
|
||||||
|
return Response.status(Response.Status.OK).type(MediaType.APPLICATION_XML).entity(version.getPom().getPom()).build();
|
||||||
|
}
|
||||||
|
case XML ->
|
||||||
|
{
|
||||||
|
Optional<ArtifactId> artifactOptional = artifactService.find(mavenContext.groupId(), mavenContext.artifactId());
|
||||||
|
if (artifactOptional.isPresent())
|
||||||
|
{
|
||||||
|
ArtifactId artifact = artifactOptional.get();
|
||||||
|
String metadata = new XmlMapper().writeValueAsString(new Metadata(artifact.getGroupId(), artifact.getArtifactId(), null, artifact.getUpdatedAt().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"))));
|
||||||
|
switch (mavenContext.file().getHash())
|
||||||
|
{
|
||||||
|
case SHA1 ->
|
||||||
|
{
|
||||||
|
return Response.ok().type(MediaType.TEXT_PLAIN).entity(DigestUtils.sha1Hex(metadata)).build();
|
||||||
|
}
|
||||||
|
case MD5 ->
|
||||||
|
{
|
||||||
|
return Response.ok().type(MediaType.TEXT_PLAIN).entity(DigestUtils.md5Hex(metadata)).build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Response.ok().type(MediaType.APPLICATION_XML).entity(metadata).build();
|
||||||
|
}
|
||||||
|
return Response.status(Response.Status.NOT_FOUND).build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new RuntimeException();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,57 @@
|
|||||||
|
package dev.dinauer.maven.maven.core;
|
||||||
|
|
||||||
|
import dev.dinauer.maven.jpa.events.Event;
|
||||||
|
import dev.dinauer.maven.jpa.events.EventType;
|
||||||
|
import dev.dinauer.maven.jpa.events.Resource;
|
||||||
|
import dev.dinauer.maven.jpa.events.repo.EventRepo;
|
||||||
|
import dev.dinauer.maven.jpa.maven.ArtifactId;
|
||||||
|
import dev.dinauer.maven.jpa.maven.Version;
|
||||||
|
import dev.dinauer.maven.jpa.maven.repo.VersionRepo;
|
||||||
|
import dev.dinauer.maven.maven.token.TokenService;
|
||||||
|
import jakarta.enterprise.context.ApplicationScoped;
|
||||||
|
import jakarta.inject.Inject;
|
||||||
|
|
||||||
|
import java.time.ZonedDateTime;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
@ApplicationScoped
|
||||||
|
public class VersionService
|
||||||
|
{
|
||||||
|
@Inject
|
||||||
|
VersionRepo versionRepo;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
ArtifactService artifactService;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
EventRepo eventRepo;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
TokenService tokenService;
|
||||||
|
|
||||||
|
public Optional<Version> findOptional(String groupId, String artifactId, String version)
|
||||||
|
{
|
||||||
|
return versionRepo.findOptionalByVersion(groupId, artifactId, version);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Version findOrCreate(String groupId, String artifactId, String version)
|
||||||
|
{
|
||||||
|
Optional<Version> versionOptional = versionRepo.findOptionalByVersion(groupId, artifactId, version);
|
||||||
|
if (versionOptional.isPresent())
|
||||||
|
{
|
||||||
|
return versionOptional.get();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ArtifactId artifact = artifactService.findOrCreate(groupId, artifactId);
|
||||||
|
artifact.setUpdatedAt(ZonedDateTime.now());
|
||||||
|
return new Version().setVersion(version).setArtifact(artifact).setGroupId(groupId).setArtifactId(artifactId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void persist(Version version)
|
||||||
|
{
|
||||||
|
versionRepo.persist(version);
|
||||||
|
eventRepo.persist(new Event().setAccountId(tokenService.require()).setType(EventType.UPLOAD).setResource(new Resource().setGroupId(version.getGroupId()).setArtifactId(version.getArtifactId()).setVersion(version.getVersion())).setTimestamp(ZonedDateTime.now()));
|
||||||
|
}
|
||||||
|
}
|
||||||
89
src/main/java/dev/dinauer/maven/maven/core/model/File.java
Normal file
89
src/main/java/dev/dinauer/maven/maven/core/model/File.java
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
package dev.dinauer.maven.maven.core.model;
|
||||||
|
|
||||||
|
import jakarta.ws.rs.BadRequestException;
|
||||||
|
import org.apache.commons.io.FilenameUtils;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class File
|
||||||
|
{
|
||||||
|
private static final String METADATA_FILENAME = "maven-metadata";
|
||||||
|
private static final List<String> FILE_TYPES = List.of("jar", "pom", "xml");
|
||||||
|
private static final List<String> FILE_HASHES = List.of("md5", "sha1");
|
||||||
|
|
||||||
|
private String raw;
|
||||||
|
private String base;
|
||||||
|
private FileType type;
|
||||||
|
private FileHash hash;
|
||||||
|
|
||||||
|
public String getRaw()
|
||||||
|
{
|
||||||
|
return raw;
|
||||||
|
}
|
||||||
|
|
||||||
|
public File setRaw(String raw)
|
||||||
|
{
|
||||||
|
this.raw = raw;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBase()
|
||||||
|
{
|
||||||
|
return base;
|
||||||
|
}
|
||||||
|
|
||||||
|
public File setBase(String base)
|
||||||
|
{
|
||||||
|
this.base = base;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FileType getType()
|
||||||
|
{
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public File setType(FileType type)
|
||||||
|
{
|
||||||
|
this.type = type;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FileHash getHash()
|
||||||
|
{
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
public File setHash(FileHash hash)
|
||||||
|
{
|
||||||
|
this.hash = hash;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static File parse(String raw)
|
||||||
|
{
|
||||||
|
File file = new File().setRaw(raw);
|
||||||
|
String extension = FilenameUtils.getExtension(raw);
|
||||||
|
String base = FilenameUtils.getBaseName(raw);
|
||||||
|
if (FILE_TYPES.contains(extension.toLowerCase()))
|
||||||
|
{
|
||||||
|
file.setType(FileType.valueOf(extension.toUpperCase()));
|
||||||
|
file.setBase(base);
|
||||||
|
file.setHash(FileHash.NONE);
|
||||||
|
return file;
|
||||||
|
}
|
||||||
|
if (FILE_HASHES.contains(extension))
|
||||||
|
{
|
||||||
|
file.setHash(FileHash.valueOf(extension.toUpperCase()));
|
||||||
|
String secondaryExtension = FilenameUtils.getExtension(base);
|
||||||
|
String secondaryBase = FilenameUtils.getBaseName(base);
|
||||||
|
if (FILE_TYPES.contains(secondaryExtension.toLowerCase()))
|
||||||
|
{
|
||||||
|
file.setType(FileType.valueOf(secondaryExtension.toUpperCase()));
|
||||||
|
file.setBase(secondaryBase);
|
||||||
|
return file;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new BadRequestException();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,6 @@
|
|||||||
|
package dev.dinauer.maven.maven.core.model;
|
||||||
|
|
||||||
|
public enum FileHash
|
||||||
|
{
|
||||||
|
SHA1, MD5, NONE
|
||||||
|
}
|
||||||
@ -0,0 +1,6 @@
|
|||||||
|
package dev.dinauer.maven.maven.core.model;
|
||||||
|
|
||||||
|
public enum FileType
|
||||||
|
{
|
||||||
|
JAR, POM, XML
|
||||||
|
}
|
||||||
@ -0,0 +1,5 @@
|
|||||||
|
package dev.dinauer.maven.maven.core.model;
|
||||||
|
|
||||||
|
public record MavenContext(String groupId, String artifactId, Version version, File file)
|
||||||
|
{
|
||||||
|
}
|
||||||
@ -0,0 +1,5 @@
|
|||||||
|
package dev.dinauer.maven.maven.core.model;
|
||||||
|
|
||||||
|
public record MavenMetadataContext(String groupId, String artifactId)
|
||||||
|
{
|
||||||
|
}
|
||||||
@ -0,0 +1,29 @@
|
|||||||
|
package dev.dinauer.maven.maven.core.model;
|
||||||
|
|
||||||
|
public class Version
|
||||||
|
{
|
||||||
|
private String raw;
|
||||||
|
private Boolean isSnapshot;
|
||||||
|
|
||||||
|
public String getRaw()
|
||||||
|
{
|
||||||
|
return raw;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Version setRaw(String raw)
|
||||||
|
{
|
||||||
|
this.raw = raw;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getSnapshot()
|
||||||
|
{
|
||||||
|
return isSnapshot;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Version setSnapshot(Boolean snapshot)
|
||||||
|
{
|
||||||
|
isSnapshot = snapshot;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
94
src/main/java/dev/dinauer/maven/maven/token/TokenEntity.java
Normal file
94
src/main/java/dev/dinauer/maven/maven/token/TokenEntity.java
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
package dev.dinauer.maven.maven.token;
|
||||||
|
|
||||||
|
import jakarta.persistence.*;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.ZonedDateTime;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(name = "token")
|
||||||
|
public class TokenEntity
|
||||||
|
{
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.UUID)
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Column(name = "user_id")
|
||||||
|
private String userId;
|
||||||
|
|
||||||
|
private String token;
|
||||||
|
|
||||||
|
@Column(name = "expires_at")
|
||||||
|
private LocalDate expiresAt;
|
||||||
|
|
||||||
|
@Column(name = "created_at")
|
||||||
|
private ZonedDateTime createdAt;
|
||||||
|
|
||||||
|
public String getId()
|
||||||
|
{
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TokenEntity setId(String id)
|
||||||
|
{
|
||||||
|
this.id = id;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName()
|
||||||
|
{
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TokenEntity setName(String name)
|
||||||
|
{
|
||||||
|
this.name = name;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserId()
|
||||||
|
{
|
||||||
|
return userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TokenEntity setUserId(String userId)
|
||||||
|
{
|
||||||
|
this.userId = userId;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getToken()
|
||||||
|
{
|
||||||
|
return token;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TokenEntity setToken(String token)
|
||||||
|
{
|
||||||
|
this.token = token;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LocalDate getExpiresAt()
|
||||||
|
{
|
||||||
|
return expiresAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TokenEntity setExpiresAt(LocalDate expiresAt)
|
||||||
|
{
|
||||||
|
this.expiresAt = expiresAt;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ZonedDateTime getCreatedAt()
|
||||||
|
{
|
||||||
|
return createdAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TokenEntity setCreatedAt(ZonedDateTime createdAt)
|
||||||
|
{
|
||||||
|
this.createdAt = createdAt;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
17
src/main/java/dev/dinauer/maven/maven/token/TokenRepo.java
Normal file
17
src/main/java/dev/dinauer/maven/maven/token/TokenRepo.java
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
package dev.dinauer.maven.maven.token;
|
||||||
|
|
||||||
|
import dev.dinauer.maven.maven.token.dto.Token;
|
||||||
|
import io.quarkus.hibernate.orm.panache.PanacheRepositoryBase;
|
||||||
|
import io.quarkus.panache.common.Parameters;
|
||||||
|
import jakarta.enterprise.context.ApplicationScoped;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@ApplicationScoped
|
||||||
|
public class TokenRepo implements PanacheRepositoryBase<TokenEntity, String>
|
||||||
|
{
|
||||||
|
public List<TokenEntity> findByUserId(String userId)
|
||||||
|
{
|
||||||
|
return list("userId = :userId", Parameters.with("userId", userId));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,39 @@
|
|||||||
|
package dev.dinauer.maven.maven.token;
|
||||||
|
|
||||||
|
import dev.dinauer.maven.maven.token.dto.Token;
|
||||||
|
import dev.dinauer.maven.maven.token.dto.TokenCreation;
|
||||||
|
import dev.dinauer.maven.maven.token.dto.TokenSecret;
|
||||||
|
import jakarta.inject.Inject;
|
||||||
|
import jakarta.transaction.Transactional;
|
||||||
|
import jakarta.ws.rs.GET;
|
||||||
|
import jakarta.ws.rs.POST;
|
||||||
|
import jakarta.ws.rs.Path;
|
||||||
|
import jakarta.ws.rs.core.SecurityContext;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Path("/tokens")
|
||||||
|
public class TokenResource
|
||||||
|
{
|
||||||
|
@Inject
|
||||||
|
TokenService tokenService;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
TokenRepo tokenRepo;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
SecurityContext securityContext;
|
||||||
|
|
||||||
|
@GET
|
||||||
|
public List<Token> get()
|
||||||
|
{
|
||||||
|
return tokenRepo.findByUserId(securityContext.getUserPrincipal().getName()).stream().map(item -> new Token(item.getName(), item.getExpiresAt(), item.getCreatedAt())).toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@POST
|
||||||
|
@Transactional
|
||||||
|
public TokenSecret create(TokenCreation tokenCreation)
|
||||||
|
{
|
||||||
|
return tokenService.create(tokenCreation);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,84 @@
|
|||||||
|
package dev.dinauer.maven.maven.token;
|
||||||
|
|
||||||
|
import dev.dinauer.maven.maven.token.dto.TokenCreation;
|
||||||
|
import dev.dinauer.maven.maven.token.dto.TokenSecret;
|
||||||
|
import io.quarkus.elytron.security.common.BcryptUtil;
|
||||||
|
import io.quarkus.security.UnauthorizedException;
|
||||||
|
import io.vertx.core.http.HttpHeaders;
|
||||||
|
import jakarta.enterprise.context.ApplicationScoped;
|
||||||
|
import jakarta.inject.Inject;
|
||||||
|
import io.vertx.core.http.HttpServerRequest;
|
||||||
|
import jakarta.ws.rs.BadRequestException;
|
||||||
|
import jakarta.ws.rs.core.SecurityContext;
|
||||||
|
import org.eclipse.microprofile.config.inject.ConfigProperty;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.ZonedDateTime;
|
||||||
|
import java.util.Base64;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@ApplicationScoped
|
||||||
|
public class TokenService
|
||||||
|
{
|
||||||
|
@Inject
|
||||||
|
TokenRepo tokenRepo;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
HttpServerRequest request;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
SecurityContext securityContext;
|
||||||
|
|
||||||
|
@ConfigProperty(name = "dev.dinauer.maven.auth.enabled")
|
||||||
|
Boolean authEnabled;
|
||||||
|
|
||||||
|
public TokenSecret create(TokenCreation tokenCreation)
|
||||||
|
{
|
||||||
|
String secret = UUID.randomUUID().toString();
|
||||||
|
TokenEntity entity = new TokenEntity()
|
||||||
|
.setName(tokenCreation.name())
|
||||||
|
.setToken(BcryptUtil.bcryptHash(secret))
|
||||||
|
.setUserId(securityContext.getUserPrincipal().getName())
|
||||||
|
.setExpiresAt(tokenCreation.expiresAt())
|
||||||
|
.setCreatedAt(ZonedDateTime.now());
|
||||||
|
tokenRepo.persist(entity);
|
||||||
|
return new TokenSecret(tokenCreation.name(), tokenCreation.expiresAt(), secret, entity.getCreatedAt());
|
||||||
|
}
|
||||||
|
|
||||||
|
public String require()
|
||||||
|
{
|
||||||
|
if (Boolean.FALSE.equals(authEnabled))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
String authHeader = request.getHeader(HttpHeaders.AUTHORIZATION);
|
||||||
|
if (authHeader != null && !authHeader.isBlank())
|
||||||
|
{
|
||||||
|
String[] sections = authHeader.split("\\s+");
|
||||||
|
if (sections.length == 2 && sections[0].equals("Basic"))
|
||||||
|
{
|
||||||
|
String value = new String(Base64.getDecoder().decode(sections[1]));
|
||||||
|
String[] parts = value.split(":");
|
||||||
|
if (parts.length == 2)
|
||||||
|
{
|
||||||
|
String username = parts[0];
|
||||||
|
String password = parts[1];
|
||||||
|
for (TokenEntity token : tokenRepo.findByUserId(username))
|
||||||
|
{
|
||||||
|
if (BcryptUtil.matches(password, token.getToken()))
|
||||||
|
{
|
||||||
|
LocalDate now = LocalDate.now();
|
||||||
|
if (now.equals(token.getExpiresAt()) || now.isBefore(token.getExpiresAt()))
|
||||||
|
{
|
||||||
|
return username;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new UnauthorizedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new BadRequestException();
|
||||||
|
}
|
||||||
|
throw new UnauthorizedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
package dev.dinauer.maven.maven.token.dto;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.ZonedDateTime;
|
||||||
|
|
||||||
|
public record Token(String name, LocalDate expiresAt, ZonedDateTime createdAt)
|
||||||
|
{
|
||||||
|
}
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
package dev.dinauer.maven.maven.token.dto;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
public record TokenCreation(String name, LocalDate expiresAt)
|
||||||
|
{
|
||||||
|
}
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
package dev.dinauer.maven.maven.token.dto;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.ZonedDateTime;
|
||||||
|
|
||||||
|
public record TokenSecret(String name, LocalDate expiresAt, String token, ZonedDateTime createdAt)
|
||||||
|
{
|
||||||
|
}
|
||||||
5
src/main/java/dev/dinauer/maven/metadata/Metadata.java
Normal file
5
src/main/java/dev/dinauer/maven/metadata/Metadata.java
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
package dev.dinauer.maven.metadata;
|
||||||
|
|
||||||
|
public record Metadata(String groupId, String artifactId, Versioning versioning, String lastUpdated)
|
||||||
|
{
|
||||||
|
}
|
||||||
5
src/main/java/dev/dinauer/maven/metadata/Version.java
Normal file
5
src/main/java/dev/dinauer/maven/metadata/Version.java
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
package dev.dinauer.maven.metadata;
|
||||||
|
|
||||||
|
public class Version
|
||||||
|
{
|
||||||
|
}
|
||||||
5
src/main/java/dev/dinauer/maven/metadata/Versioning.java
Normal file
5
src/main/java/dev/dinauer/maven/metadata/Versioning.java
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
package dev.dinauer.maven.metadata;
|
||||||
|
|
||||||
|
public class Versioning
|
||||||
|
{
|
||||||
|
}
|
||||||
5
src/main/java/dev/dinauer/maven/user/User.java
Normal file
5
src/main/java/dev/dinauer/maven/user/User.java
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
package dev.dinauer.maven.user;
|
||||||
|
|
||||||
|
public record User(String id, String firstname, String lastname, String email)
|
||||||
|
{
|
||||||
|
}
|
||||||
23
src/main/java/dev/dinauer/maven/user/UserClient.java
Normal file
23
src/main/java/dev/dinauer/maven/user/UserClient.java
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
package dev.dinauer.maven.user;
|
||||||
|
|
||||||
|
import io.quarkus.oidc.client.filter.OidcClientFilter;
|
||||||
|
import jakarta.ws.rs.GET;
|
||||||
|
import jakarta.ws.rs.POST;
|
||||||
|
import jakarta.ws.rs.Path;
|
||||||
|
import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Path("/realms/maven/accounts")
|
||||||
|
@OidcClientFilter
|
||||||
|
@RegisterRestClient(configKey = "idp")
|
||||||
|
public interface UserClient
|
||||||
|
{
|
||||||
|
@GET
|
||||||
|
List<User> getUser();
|
||||||
|
|
||||||
|
@POST
|
||||||
|
@Path("/search")
|
||||||
|
Map<String, User> get(List<String> ids);
|
||||||
|
}
|
||||||
24
src/main/java/dev/dinauer/maven/user/UserResource.java
Normal file
24
src/main/java/dev/dinauer/maven/user/UserResource.java
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
package dev.dinauer.maven.user;
|
||||||
|
|
||||||
|
import io.quarkus.security.identity.SecurityIdentity;
|
||||||
|
import jakarta.inject.Inject;
|
||||||
|
import jakarta.ws.rs.GET;
|
||||||
|
import jakarta.ws.rs.Path;
|
||||||
|
import org.eclipse.microprofile.rest.client.inject.RestClient;
|
||||||
|
|
||||||
|
@Path("/users")
|
||||||
|
public class UserResource
|
||||||
|
{
|
||||||
|
@RestClient
|
||||||
|
UserClient userClient;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
SecurityIdentity identity;
|
||||||
|
|
||||||
|
@GET
|
||||||
|
public Object get()
|
||||||
|
{
|
||||||
|
System.out.println(identity.getPrincipal().getName());
|
||||||
|
return userClient.getUser();
|
||||||
|
}
|
||||||
|
}
|
||||||
38
src/main/resources/application.properties
Normal file
38
src/main/resources/application.properties
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
# HTTP
|
||||||
|
quarkus.http.cors.enabled=true
|
||||||
|
quarkus.http.port=8081
|
||||||
|
%dev.quarkus.http.cors.origins=/.*/
|
||||||
|
%dev.quarkus.http.cors.access-control-allow-credentials=true
|
||||||
|
|
||||||
|
%dev.dev.dinauer.maven.auth.enabled=false
|
||||||
|
%true.dev.dinauer.maven.auth.enabled=true
|
||||||
|
|
||||||
|
# Auth
|
||||||
|
quarkus.http.auth.permission.authenticated.paths=/*
|
||||||
|
quarkus.http.auth.permission.authenticated.policy=authenticated
|
||||||
|
quarkus.http.auth.permission.permit.paths=/callback
|
||||||
|
quarkus.http.auth.permission.permit.policy=permit
|
||||||
|
|
||||||
|
# Postgres
|
||||||
|
%dev,test.quarkus.datasource.db-kind=postgresql
|
||||||
|
%dev,test.quarkus.hibernate-orm.schema-management.strategy=drop-and-create
|
||||||
|
%dev,test.quarkus.datasource.username=postgres
|
||||||
|
%dev,test.quarkus.datasource.password=postgres
|
||||||
|
%dev,test.quarkus.datasource.jdbc.url=jdbc:postgresql://localhost:5432/postgres
|
||||||
|
|
||||||
|
quarkus.rest-client.auth.url=http://localhost:8089/api/iam-backend
|
||||||
|
|
||||||
|
quarkus.oidc.auth-server-url=http://localhost:8089/api/iam-backend/realms/maven
|
||||||
|
quarkus.oidc.client-id=backend
|
||||||
|
quarkus.oidc.token.audience=backend
|
||||||
|
|
||||||
|
quarkus.oidc-client.auth-server-url=http://localhost:8089/api/iam-backend/realms/maven
|
||||||
|
quarkus.oidc-client.client-id=backend
|
||||||
|
quarkus.oidc-client.credentials.secret=backend
|
||||||
|
|
||||||
|
quarkus.oidc-client.ac.auth-server-url=http://localhost:8089/api/iam-backend/realms/maven
|
||||||
|
quarkus.oidc-client.ac.client-id=backend
|
||||||
|
quarkus.oidc-client.ac.credentials.secret=backend
|
||||||
|
quarkus.oidc-client.ac.grant.type=code
|
||||||
|
|
||||||
|
quarkus.rest-client.idp.url=http://localhost:8089/api/iam-backend
|
||||||
2
src/main/resources/import.sql
Normal file
2
src/main/resources/import.sql
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
INSERT INTO token (id, name, user_id, token, expires_at, created_at)
|
||||||
|
VALUES (gen_random_uuid(), 'Test Token', 'user', '$2a$12$zfUeyF7nFrzyd2RbhtlV1.7mQiOpOBADd3j/GvPUc/kjcIrIBhaGC', '2030-12-31', NOW());
|
||||||
BIN
src/main/resources/jar/httpclient5-5.6.jar
Normal file
BIN
src/main/resources/jar/httpclient5-5.6.jar
Normal file
Binary file not shown.
BIN
src/main/resources/jar/jackson-core-2.21.0.jar
Normal file
BIN
src/main/resources/jar/jackson-core-2.21.0.jar
Normal file
Binary file not shown.
BIN
src/main/resources/jar/postgresql-42.7.9.jar
Normal file
BIN
src/main/resources/jar/postgresql-42.7.9.jar
Normal file
Binary file not shown.
147
src/main/resources/jar/postgresql-42.7.9.pom
Normal file
147
src/main/resources/jar/postgresql-42.7.9.pom
Normal file
@ -0,0 +1,147 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>dev.dinauer.maven</groupId>
|
||||||
|
<artifactId>demo</artifactId>
|
||||||
|
<version>1.0.3</version>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<compiler-plugin.version>3.14.1</compiler-plugin.version>
|
||||||
|
<maven.compiler.release>21</maven.compiler.release>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
|
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
|
||||||
|
<quarkus.platform.group-id>io.quarkus.platform</quarkus.platform.group-id>
|
||||||
|
<quarkus.platform.version>3.30.8</quarkus.platform.version>
|
||||||
|
<skipITs>true</skipITs>
|
||||||
|
<surefire-plugin.version>3.5.4</surefire-plugin.version>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<distributionManagement>
|
||||||
|
<repository>
|
||||||
|
<id>demo</id>
|
||||||
|
<url>http://localhost:8080/maven2</url>
|
||||||
|
</repository>
|
||||||
|
</distributionManagement>
|
||||||
|
|
||||||
|
<dependencyManagement>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>${quarkus.platform.group-id}</groupId>
|
||||||
|
<artifactId>${quarkus.platform.artifact-id}</artifactId>
|
||||||
|
<version>${quarkus.platform.version}</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</dependencyManagement>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.quarkus</groupId>
|
||||||
|
<artifactId>quarkus-arc</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.quarkus</groupId>
|
||||||
|
<artifactId>quarkus-rest</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.quarkus</groupId>
|
||||||
|
<artifactId>quarkus-junit5</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.rest-assured</groupId>
|
||||||
|
<artifactId>rest-assured</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>${quarkus.platform.group-id}</groupId>
|
||||||
|
<artifactId>quarkus-maven-plugin</artifactId>
|
||||||
|
<version>${quarkus.platform.version}</version>
|
||||||
|
<extensions>true</extensions>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>build</goal>
|
||||||
|
<goal>generate-code</goal>
|
||||||
|
<goal>generate-code-tests</goal>
|
||||||
|
<goal>native-image-agent</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>${compiler-plugin.version}</version>
|
||||||
|
<configuration>
|
||||||
|
<parameters>true</parameters>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
<version>${surefire-plugin.version}</version>
|
||||||
|
<configuration>
|
||||||
|
<argLine>--add-opens java.base/java.lang=ALL-UNNAMED</argLine>
|
||||||
|
<systemPropertyVariables>
|
||||||
|
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
|
||||||
|
<maven.home>${maven.home}</maven.home>
|
||||||
|
</systemPropertyVariables>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-failsafe-plugin</artifactId>
|
||||||
|
<version>${surefire-plugin.version}</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>integration-test</goal>
|
||||||
|
<goal>verify</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
<configuration>
|
||||||
|
<argLine>--add-opens java.base/java.lang=ALL-UNNAMED</argLine>
|
||||||
|
<systemPropertyVariables>
|
||||||
|
<native.image.path>${project.build.directory}/${project.build.finalName}-runner</native.image.path>
|
||||||
|
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
|
||||||
|
<maven.home>${maven.home}</maven.home>
|
||||||
|
</systemPropertyVariables>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-deploy-plugin</artifactId>
|
||||||
|
<version>2.8.1</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>default-deploy</id>
|
||||||
|
<phase>deploy</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>deploy</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
<profiles>
|
||||||
|
<profile>
|
||||||
|
<id>native</id>
|
||||||
|
<activation>
|
||||||
|
<property>
|
||||||
|
<name>native</name>
|
||||||
|
</property>
|
||||||
|
</activation>
|
||||||
|
<properties>
|
||||||
|
<quarkus.package.jar.enabled>false</quarkus.package.jar.enabled>
|
||||||
|
<skipITs>false</skipITs>
|
||||||
|
<quarkus.native.enabled>true</quarkus.native.enabled>
|
||||||
|
</properties>
|
||||||
|
</profile>
|
||||||
|
</profiles>
|
||||||
|
</project>
|
||||||
Loading…
x
Reference in New Issue
Block a user