Compare commits

..

No commits in common. "e722e5dde4743c572b97a24fbd66d63671485b4f" and "bd7a5c983042597ceca28f8986fa8cb2f0922618" have entirely different histories.

11 changed files with 56 additions and 194 deletions

1
.gitignore vendored
View File

@ -16,4 +16,3 @@ target
debug.out debug.out
.DS_Store .DS_Store
dependency-reduced-pom.xml

View File

@ -14,5 +14,5 @@
# KIND, either express or implied. See the License for the # KIND, either express or implied. See the License for the
# specific language governing permissions and limitations # specific language governing permissions and limitations
# under the License. # under the License.
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.11/apache-maven-3.9.11-bin.zip distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.6/apache-maven-3.8.6-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar

View File

@ -33,11 +33,6 @@ Um das Image mit NativeImage / GraalVM zu bauen, rufst du einfach Maven mit dem
Ziel install auf: Ziel install auf:
```./mvnw -Dnative install``` ```./mvnw -Dnative install```
## Bau einer fat jar Datei
Über das Profil fatjar läßt sich auch ein fat jar File bauen, welches alle Abhängigkeiten enthält.
```./mvnw -Dimage install```
## Ergebnisse der statischen Codeanalyse ## Ergebnisse der statischen Codeanalyse
Die Codeanalyse läuft automatisch beim Bau des Projektes und die Ergebnisse Die Codeanalyse läuft automatisch beim Bau des Projektes und die Ergebnisse

View File

@ -14,5 +14,3 @@
## Sonstiges ## Sonstiges
- Reporting - Reporting
- Lombok - Lombok
## [Fragen und Antworten](qa.md)

View File

@ -1,4 +0,0 @@
# Fragen und Antworten

View File

@ -27,11 +27,6 @@ To build the image with jpackage, the profile image must be used:
To build the native image with GraalVM, the profile native must be used: To build the native image with GraalVM, the profile native must be used:
```./mvnw -Dnative install``` ```./mvnw -Dnative install```
### Build a fat jar file
You can build a fat jar file using the fatjar Image:
```./mvnw -Dfatjar package```
## Static code analysis results ## Static code analysis results
The static code analysis is done during the build of the application. The results can be found in The static code analysis is done during the build of the application. The results can be found in

View File

@ -14,5 +14,3 @@
## Other Topics ## Other Topics
- Reporting - Reporting
- Lombok - Lombok
## [Questions and Answers](qa.md)

View File

@ -1,2 +0,0 @@
# Questions and Answers

160
pom.xml
View File

@ -7,7 +7,7 @@
<!-- Edit these to match your project --> <!-- Edit these to match your project -->
<groupId>de.kneitzel</groupId> <groupId>de.kneitzel</groupId>
<artifactId>javamavenapp</artifactId> <artifactId>javamavenapp</artifactId>
<version>1.1-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
@ -24,36 +24,35 @@
<launcher>${project.artifactId}</launcher> <launcher>${project.artifactId}</launcher>
<appName>${project.artifactId}</appName> <appName>${project.artifactId}</appName>
<main.class>de.kneitzel.JavaApp</main.class> <main.class>de.kneitzel.JavaApp</main.class>
<java.version>25</java.version> <java.version>21</java.version>
<jar.filename>${project.artifactId}-${project.version}</jar.filename> <jar.filename>${project.artifactId}-${project.version}</jar.filename>
<!-- Dependency versions --> <!-- Dependency versions -->
<jetbrains.annotations.version>26.0.2-1</jetbrains.annotations.version> <jetbrains.annotations.version>24.1.0</jetbrains.annotations.version>
<junit.version>6.0.1</junit.version> <junit.version>5.10.2</junit.version>
<lombok.version>1.18.42</lombok.version> <lombok.version>1.18.32</lombok.version>
<mockito.version>5.20.0</mockito.version> <mockito.version>5.11.0</mockito.version>
<spotbugs.version>4.9.8</spotbugs.version> <spotbugs.version>4.8.5</spotbugs.version>
<!-- Plugin dependencies --> <!-- Plugin dependencies -->
<codehaus.version.plugin>2.20.1</codehaus.version.plugin> <codehaus.version.plugin>2.16.2</codehaus.version.plugin>
<jpackage.maven.plugin>0.1.5</jpackage.maven.plugin> <jpackage.maven.plugin>0.1.5</jpackage.maven.plugin>
<maven.clean.plugin>3.5.0</maven.clean.plugin> <maven.clean.plugin>3.3.2</maven.clean.plugin>
<maven.compiler.plugin>3.14.1</maven.compiler.plugin> <maven.compiler.plugin>3.13.0</maven.compiler.plugin>
<maven.dependency.plugin>3.9.0</maven.dependency.plugin> <maven.dependency.plugin>3.6.1</maven.dependency.plugin>
<maven.deploy.plugin>3.1.4</maven.deploy.plugin> <maven.deploy.plugin>3.1.2</maven.deploy.plugin>
<maven.enforcer.plugin>3.6.2</maven.enforcer.plugin> <maven.enforcer.plugin>3.4.1</maven.enforcer.plugin>
<maven.install.plugin>3.1.4</maven.install.plugin> <maven.install.plugin>3.1.2</maven.install.plugin>
<maven.jar.plugin>3.5.0</maven.jar.plugin> <maven.jar.plugin>3.4.1</maven.jar.plugin>
<maven.javadoc.plugin>3.12.0</maven.javadoc.plugin> <maven.javadoc.plugin>3.6.3</maven.javadoc.plugin>
<maven.pmd.plugin>3.28.0</maven.pmd.plugin> <maven.pmd.plugin>3.22.0</maven.pmd.plugin>
<maven.project.info.reports.plugin>3.9.0</maven.project.info.reports.plugin> <maven.project.info.reports.plugin>3.5.0</maven.project.info.reports.plugin>
<maven.resources.plugin>3.4.0</maven.resources.plugin> <maven.resources.plugin>3.3.1</maven.resources.plugin>
<maven.shade.plugin>3.6.1</maven.shade.plugin> <maven.site.plugin>4.0.0-M14</maven.site.plugin>
<maven.site.plugin>4.0.0-M16</maven.site.plugin> <maven.surfire.plugin>3.2.5</maven.surfire.plugin>
<maven.surfire.plugin>3.5.4</maven.surfire.plugin>
<moditect.maven.plugin>1.0.0.RC2</moditect.maven.plugin> <moditect.maven.plugin>1.0.0.RC2</moditect.maven.plugin>
<native.maven.plugin>0.11.3</native.maven.plugin> <native.maven.plugin>0.10.1</native.maven.plugin>
<spotbugs.maven.plugin>4.9.8.2</spotbugs.maven.plugin> <spotbugs.maven.plugin>4.8.5.0</spotbugs.maven.plugin>
<!-- other properties --> <!-- other properties -->
<pmd.target>pmd</pmd.target> <!-- Set to 'pmd' if pmd should not fail on issues. Set to 'check' if you want build to fail when issues found --> <pmd.target>pmd</pmd.target> <!-- Set to 'pmd' if pmd should not fail on issues. Set to 'check' if you want build to fail when issues found -->
@ -142,6 +141,16 @@
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>${maven.compiler.plugin}</version> <version>${maven.compiler.plugin}</version>
<configuration>
<release>${java.version}</release>
<annotationProcessorPaths>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin> </plugin>
<!--Test execution --> <!--Test execution -->
@ -241,43 +250,11 @@
<version>${maven.install.plugin}</version> <version>${maven.install.plugin}</version>
</plugin> </plugin>
<!-- jar plugin - set man class and classpath --> <!-- jar plugin - to remove the warning regarding version -->
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId> <artifactId>maven-jar-plugin</artifactId>
<version>${maven.jar.plugin}</version> <version>${maven.jar.plugin}</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
<mainClass>${main.class}</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<!-- dependency plugin - copy dependencies to lib folder. -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>${maven.dependency.plugin}</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
<includeScope>runtime</includeScope>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin> </plugin>
<!-- resources plugin - to remove the warning regarding version --> <!-- resources plugin - to remove the warning regarding version -->
@ -506,75 +483,6 @@
</build> </build>
</profile> </profile>
<!-- Profile to build a fat jar
Add -Pfatjar or -Dfatjar to use this profile.
-->
<profile>
<id>fatjar</id>
<activation>
<property>
<name>fatjar</name>
</property>
</activation>
<build>
<plugins>
<!-- Set jar plugin to not set classpath -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>${maven.jar.plugin}</version>
<configuration>
<archive>
<manifest>
<addClasspath>false</addClasspath>
</manifest>
</archive>
</configuration>
</plugin>
<!-- build the fat jar -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>${maven.shade.plugin}</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
<configuration>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>full</shadedClassifierName>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<manifestEntries>
<Main-Class>${main.class}</Main-Class>
<Build-Version>1.0</Build-Version>
</manifestEntries>
</transformer>
</transformers>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/MANIFEST.MF</exclude>
<exclude>**/module-info.class</exclude>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles> </profiles>
</project> </project>

View File

@ -2,60 +2,51 @@ package de.kneitzel;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
/** /**
* Simple greeting value object used for demonstration purposes. * Simple Greeting class for some demonstration.
*
* <p>Instances are immutable and encapsulate a single name that is used when generating
* a greeting string via {@link #toString()}.
*/ */
public class Greeting { public class Greeting {
/** /**
* Default name used when no explicit name is provided. The default value is the German * Default name that should be greeted if no name is given.
* word {@code "Welt"} ("world").
*/ */
public static final String DEFAULT_NAME = "Welt"; public static final String DEFAULT_NAME = "Welt";
/** /**
* The name to greet. Never {@code null}. * Name that should be greeted
* <p>
* Cannot be null.
* </p>
*/ */
@NotNull @NotNull
private final String name; private final String name;
/** /**
* Returns the name that will be greeted. * Gets the name that should be greeted.
* * @return Name that should be greeted.
* @return the name to greet; never {@code null}.
*/ */
public @NotNull String getName() { public @NotNull String getName() {
return name; return name;
} }
/** /**
* Creates a new {@code Greeting} instance that greets the default name ({@link #DEFAULT_NAME}). * Creates a new Instance of Greeting which greets the "World".
*/ */
public Greeting() { public Greeting() {
this(null); this(null);
} }
/** /**
* Creates a new {@code Greeting} instance for the given name. * Creates a new instance of Greeting to greet the given name.
* * @param name Name that should be greeted by Greeting.
* @param name the name to greet; may be {@code null} in which case {@link #DEFAULT_NAME}
* will be used instead.
*/ */
public Greeting(@Nullable final String name) { public Greeting(@Nullable final String name) {
this.name = name == null ? DEFAULT_NAME : name; this.name = name == null ? DEFAULT_NAME : name;
} }
/** /**
* Returns a greeting string for this instance. * String representation of this instance.
* * @return String representation of "Hello name!"
* <p>The greeting is formatted in German as {@code "Hallo <name>!"}. The returned string is
* never {@code null}.
*
* @return a greeting such as {@code "Hallo Welt!"}; never {@code null}.
*/ */
@NotNull @NotNull
@Override @Override

View File

@ -1,39 +1,23 @@
package de.kneitzel; package de.kneitzel;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.util.Objects;
/** /**
* Entry point for the JavaMavenApp application. * Starting point of the JavaApp
*
* <p>This final utility class is not instantiable and provides the application's main method.
* It coordinates startup behavior and is responsible for high-level program initialization.
*
* @since 1.0
*/ */
public final class JavaApp { public final class JavaApp {
/** /**
* Private constructor to prevent instantiation of this utility class. * Private Constructor - we never create an instance!
*
* <p>The class only exposes static behavior and should never be instantiated.
*/ */
private JavaApp() {} private JavaApp() {}
/** /**
* Application entry point. * Entry point of the application.
* * @param args Commandline parameters.
* <p>This method initializes a {@code Greeting} instance and writes its string representation
* to standard output. The method does not parse or use {@code args} currently; they are
* preserved for future extensions.
*
* @param args the command-line arguments supplied to the application; must not be {@code null}.
* Currently unused and preserved for future extensions.
*/ */
static void main(@NotNull final String[] args) { public static void main(@NotNull final String[] args) {
// Validate the parameter and reference it to avoid unused-parameter inspections.
Objects.requireNonNull(args, "args must not be null");
final Greeting greeting = new Greeting(null); final Greeting greeting = new Greeting(null);
System.out.println(greeting); System.out.println(greeting);
} }