Compare commits
10 Commits
bd7a5c9830
...
e722e5dde4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e722e5dde4 | ||
|
|
78f4406824 | ||
|
|
dc8032d5bf | ||
|
|
a3a9eff0c2 | ||
|
|
7b1fb9bb46 | ||
|
|
35cf927c45 | ||
| 231b03ba6e | |||
|
|
a78fd2b537 | ||
|
|
543637495c | ||
|
|
bda277bcaa |
1
.gitignore
vendored
1
.gitignore
vendored
@ -16,3 +16,4 @@ target
|
||||
debug.out
|
||||
.DS_Store
|
||||
|
||||
dependency-reduced-pom.xml
|
||||
|
||||
2
.mvn/wrapper/maven-wrapper.properties
vendored
2
.mvn/wrapper/maven-wrapper.properties
vendored
@ -14,5 +14,5 @@
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.6/apache-maven-3.8.6-bin.zip
|
||||
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.11/apache-maven-3.9.11-bin.zip
|
||||
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar
|
||||
|
||||
@ -33,6 +33,11 @@ Um das Image mit NativeImage / GraalVM zu bauen, rufst du einfach Maven mit dem
|
||||
Ziel install auf:
|
||||
```./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
|
||||
|
||||
Die Codeanalyse läuft automatisch beim Bau des Projektes und die Ergebnisse
|
||||
|
||||
@ -13,4 +13,6 @@
|
||||
|
||||
## Sonstiges
|
||||
- Reporting
|
||||
- Lombok
|
||||
- Lombok
|
||||
|
||||
## [Fragen und Antworten](qa.md)
|
||||
|
||||
4
documentation/de/qa.md
Normal file
4
documentation/de/qa.md
Normal file
@ -0,0 +1,4 @@
|
||||
# Fragen und Antworten
|
||||
|
||||
|
||||
|
||||
@ -27,6 +27,11 @@ 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:
|
||||
```./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
|
||||
|
||||
The static code analysis is done during the build of the application. The results can be found in
|
||||
|
||||
@ -13,4 +13,6 @@
|
||||
|
||||
## Other Topics
|
||||
- Reporting
|
||||
- Lombok
|
||||
- Lombok
|
||||
|
||||
## [Questions and Answers](qa.md)
|
||||
|
||||
2
documentation/en/qa.md
Normal file
2
documentation/en/qa.md
Normal file
@ -0,0 +1,2 @@
|
||||
# Questions and Answers
|
||||
|
||||
160
pom.xml
160
pom.xml
@ -7,7 +7,7 @@
|
||||
<!-- Edit these to match your project -->
|
||||
<groupId>de.kneitzel</groupId>
|
||||
<artifactId>javamavenapp</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
|
||||
<packaging>jar</packaging>
|
||||
|
||||
@ -24,35 +24,36 @@
|
||||
<launcher>${project.artifactId}</launcher>
|
||||
<appName>${project.artifactId}</appName>
|
||||
<main.class>de.kneitzel.JavaApp</main.class>
|
||||
<java.version>21</java.version>
|
||||
<java.version>25</java.version>
|
||||
<jar.filename>${project.artifactId}-${project.version}</jar.filename>
|
||||
|
||||
<!-- Dependency versions -->
|
||||
<jetbrains.annotations.version>24.1.0</jetbrains.annotations.version>
|
||||
<junit.version>5.10.2</junit.version>
|
||||
<lombok.version>1.18.32</lombok.version>
|
||||
<mockito.version>5.11.0</mockito.version>
|
||||
<spotbugs.version>4.8.5</spotbugs.version>
|
||||
<jetbrains.annotations.version>26.0.2-1</jetbrains.annotations.version>
|
||||
<junit.version>6.0.1</junit.version>
|
||||
<lombok.version>1.18.42</lombok.version>
|
||||
<mockito.version>5.20.0</mockito.version>
|
||||
<spotbugs.version>4.9.8</spotbugs.version>
|
||||
|
||||
<!-- Plugin dependencies -->
|
||||
<codehaus.version.plugin>2.16.2</codehaus.version.plugin>
|
||||
<codehaus.version.plugin>2.20.1</codehaus.version.plugin>
|
||||
<jpackage.maven.plugin>0.1.5</jpackage.maven.plugin>
|
||||
<maven.clean.plugin>3.3.2</maven.clean.plugin>
|
||||
<maven.compiler.plugin>3.13.0</maven.compiler.plugin>
|
||||
<maven.dependency.plugin>3.6.1</maven.dependency.plugin>
|
||||
<maven.deploy.plugin>3.1.2</maven.deploy.plugin>
|
||||
<maven.enforcer.plugin>3.4.1</maven.enforcer.plugin>
|
||||
<maven.install.plugin>3.1.2</maven.install.plugin>
|
||||
<maven.jar.plugin>3.4.1</maven.jar.plugin>
|
||||
<maven.javadoc.plugin>3.6.3</maven.javadoc.plugin>
|
||||
<maven.pmd.plugin>3.22.0</maven.pmd.plugin>
|
||||
<maven.project.info.reports.plugin>3.5.0</maven.project.info.reports.plugin>
|
||||
<maven.resources.plugin>3.3.1</maven.resources.plugin>
|
||||
<maven.site.plugin>4.0.0-M14</maven.site.plugin>
|
||||
<maven.surfire.plugin>3.2.5</maven.surfire.plugin>
|
||||
<maven.clean.plugin>3.5.0</maven.clean.plugin>
|
||||
<maven.compiler.plugin>3.14.1</maven.compiler.plugin>
|
||||
<maven.dependency.plugin>3.9.0</maven.dependency.plugin>
|
||||
<maven.deploy.plugin>3.1.4</maven.deploy.plugin>
|
||||
<maven.enforcer.plugin>3.6.2</maven.enforcer.plugin>
|
||||
<maven.install.plugin>3.1.4</maven.install.plugin>
|
||||
<maven.jar.plugin>3.5.0</maven.jar.plugin>
|
||||
<maven.javadoc.plugin>3.12.0</maven.javadoc.plugin>
|
||||
<maven.pmd.plugin>3.28.0</maven.pmd.plugin>
|
||||
<maven.project.info.reports.plugin>3.9.0</maven.project.info.reports.plugin>
|
||||
<maven.resources.plugin>3.4.0</maven.resources.plugin>
|
||||
<maven.shade.plugin>3.6.1</maven.shade.plugin>
|
||||
<maven.site.plugin>4.0.0-M16</maven.site.plugin>
|
||||
<maven.surfire.plugin>3.5.4</maven.surfire.plugin>
|
||||
<moditect.maven.plugin>1.0.0.RC2</moditect.maven.plugin>
|
||||
<native.maven.plugin>0.10.1</native.maven.plugin>
|
||||
<spotbugs.maven.plugin>4.8.5.0</spotbugs.maven.plugin>
|
||||
<native.maven.plugin>0.11.3</native.maven.plugin>
|
||||
<spotbugs.maven.plugin>4.9.8.2</spotbugs.maven.plugin>
|
||||
|
||||
<!-- 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 -->
|
||||
@ -141,16 +142,6 @@
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<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>
|
||||
|
||||
<!--Test execution -->
|
||||
@ -250,11 +241,43 @@
|
||||
<version>${maven.install.plugin}</version>
|
||||
</plugin>
|
||||
|
||||
<!-- jar plugin - to remove the warning regarding version -->
|
||||
<!-- jar plugin - set man class and classpath -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<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>
|
||||
|
||||
<!-- resources plugin - to remove the warning regarding version -->
|
||||
@ -483,6 +506,75 @@
|
||||
</build>
|
||||
</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>
|
||||
|
||||
</project>
|
||||
|
||||
@ -2,51 +2,60 @@ package de.kneitzel;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Simple Greeting class for some demonstration.
|
||||
* Simple greeting value object used for demonstration purposes.
|
||||
*
|
||||
* <p>Instances are immutable and encapsulate a single name that is used when generating
|
||||
* a greeting string via {@link #toString()}.
|
||||
*/
|
||||
public class Greeting {
|
||||
|
||||
/**
|
||||
* Default name that should be greeted if no name is given.
|
||||
* Default name used when no explicit name is provided. The default value is the German
|
||||
* word {@code "Welt"} ("world").
|
||||
*/
|
||||
public static final String DEFAULT_NAME = "Welt";
|
||||
|
||||
/**
|
||||
* Name that should be greeted
|
||||
* <p>
|
||||
* Cannot be null.
|
||||
* </p>
|
||||
* The name to greet. Never {@code null}.
|
||||
*/
|
||||
@NotNull
|
||||
private final String name;
|
||||
|
||||
/**
|
||||
* Gets the name that should be greeted.
|
||||
* @return Name that should be greeted.
|
||||
* Returns the name that will be greeted.
|
||||
*
|
||||
* @return the name to greet; never {@code null}.
|
||||
*/
|
||||
public @NotNull String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new Instance of Greeting which greets the "World".
|
||||
* Creates a new {@code Greeting} instance that greets the default name ({@link #DEFAULT_NAME}).
|
||||
*/
|
||||
public Greeting() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new instance of Greeting to greet the given name.
|
||||
* @param name Name that should be greeted by Greeting.
|
||||
* Creates a new {@code Greeting} instance for the given name.
|
||||
*
|
||||
* @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) {
|
||||
this.name = name == null ? DEFAULT_NAME : name;
|
||||
}
|
||||
|
||||
/**
|
||||
* String representation of this instance.
|
||||
* @return String representation of "Hello name!"
|
||||
* Returns a greeting string for this instance.
|
||||
*
|
||||
* <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
|
||||
@Override
|
||||
|
||||
@ -1,23 +1,39 @@
|
||||
package de.kneitzel;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Starting point of the JavaApp
|
||||
* Entry point for the JavaMavenApp application.
|
||||
*
|
||||
* <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 {
|
||||
|
||||
/**
|
||||
* Private Constructor - we never create an instance!
|
||||
* Private constructor to prevent instantiation of this utility class.
|
||||
*
|
||||
* <p>The class only exposes static behavior and should never be instantiated.
|
||||
*/
|
||||
private JavaApp() {}
|
||||
|
||||
/**
|
||||
* Entry point of the application.
|
||||
* @param args Commandline parameters.
|
||||
* Application entry point.
|
||||
*
|
||||
* <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.
|
||||
*/
|
||||
public static void main(@NotNull final String[] args) {
|
||||
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);
|
||||
System.out.println(greeting);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user