diff --git a/ws/Archetypes/mi-maven-archetype-quickstart/src/main/resources/META-INF/maven/archetype-metadata.xml b/ws/Archetypes/mi-maven-archetype-quickstart/src/main/resources/META-INF/maven/archetype-metadata.xml index 6948a180417d33dca84a9bb9b26bb5f11f4eb766..f86d9effa3368f573f152ab17d6036ccf22403b0 100644 --- a/ws/Archetypes/mi-maven-archetype-quickstart/src/main/resources/META-INF/maven/archetype-metadata.xml +++ b/ws/Archetypes/mi-maven-archetype-quickstart/src/main/resources/META-INF/maven/archetype-metadata.xml @@ -9,6 +9,12 @@ <include>**/*.java</include> </includes> </fileSet> + <fileSet filtered="true" encoding="UTF-8"> + <directory/> + <includes> + <include>Readme.md</include> + </includes> + </fileSet> <fileSet filtered="true" encoding="UTF-8"> <directory>src/main/resources</directory> <includes> diff --git a/ws/Archetypes/mi-maven-archetype-quickstart/src/main/resources/archetype-resources/Readme.md b/ws/Archetypes/mi-maven-archetype-quickstart/src/main/resources/archetype-resources/Readme.md index c6f34af1adf54103e38fe93fdab050bacdc8eaca..df24c04d97d46ddaf0337f2cb933b5e8f186d707 100644 --- a/ws/Archetypes/mi-maven-archetype-quickstart/src/main/resources/archetype-resources/Readme.md +++ b/ws/Archetypes/mi-maven-archetype-quickstart/src/main/resources/archetype-resources/Readme.md @@ -15,10 +15,11 @@ providing the following updates / enhancements: ## Prerequisites -This archetype is available from [HdM / MI](https://maven.mi.hdm-stuttgart.de) to Maven by configuring -a file `~/.m2/settings.xml` with `~` denoting your home folder: +This archetype is available from [HdM / MI](https://maven.mi.hdm-stuttgart.de/nexus/service/rest/repository/browse/mi-maven/de/hdm_stuttgart/mi/mi-maven-archetype-quickstart/2.2) +to be used by Maven. This requires configuring access to the MI Nexus server by editing file `~/.m2/settings.xml` +with `~` denoting your home folder: -``` +```xml <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> @@ -50,14 +51,57 @@ advised to [turn this off](https://www.thewindowsclub.com/show-file-extensions-i ## Usage -Create an new project: +### Create an new project: -``` +```shell mvn --batch-mode -e archetype:generate -DgroupId=de.hdm_stuttgart.mi.sd1 \ -DartifactId=first -Dversion=0.9 -DarchetypeGroupId=de.hdm_stuttgart.mi \ -DarchetypeArtifactId=mi-maven-archetype-quickstart -DarchetypeVersion=2.2 ``` +### Generate Javadoc + +```shell +mvn javadoc:javadoc +``` + +The resulting `target/site/apidocs/index.html` entry file may be viewed by any reasonable web browser. + +### Create an executable jar file + +The `pom.xml` contains: + +```xml +... +<manifestEntries> + <Main-Class>$package.App</Main-Class> + <Multi-Release>true</Multi-Release> +</manifestEntries> +... +``` + +`App.java` is supposed to contain a `main(...)` method to be executed. Invoking `mvn package` results in: + +```shell +> mvn clean package +[INFO] Scanning for projects... +... +[INFO] Building jar: /home/goik/tmp/first/target/first-0.9.jar +... +[INFO] Replacing /home/goik/tmp/first/target/first-0.9.jar with /home/goik/tmp/first/target/first-0.9-shaded.jar +... +``` +This generated jar is ready to be executed: + +```shell +> java -jar target/first-0.9.jar +Hi there, + let's have + fun learning Java! +2022-12-17 22:56:34,478 DEBUG [main] sd1.App (App.java:38) - You may configure 'src/main/resources/log4j2.xml' +2022-12-17 22:56:34,480 DEBUG [main] sd1.App (App.java:39) - for adapting both console and 'A1.log' file output +``` + ## Details Three sample classes and one corresponding Junit test class are being provided: