Compare commits
3 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
ed1b7fc83d | |
|
|
ebb494f66b | |
|
|
9818d1d201 |
|
|
@ -1 +0,0 @@
|
||||||
/.DS_Store
|
|
||||||
|
|
@ -2,4 +2,3 @@
|
||||||
/.DS_Store
|
/.DS_Store
|
||||||
/.classpath
|
/.classpath
|
||||||
/.project
|
/.project
|
||||||
/.settings
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
/org.eclipse.core.resources.prefs
|
||||||
|
/org.eclipse.jdt.core.prefs
|
||||||
|
/org.eclipse.m2e.core.prefs
|
||||||
|
|
@ -41,38 +41,18 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>3.13.0</version>
|
<version>3.8.1</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>${maven.compiler.source}</source>
|
<source>${maven.compiler.source}</source>
|
||||||
<target>${maven.compiler.target}</target>
|
<target>${maven.compiler.target}</target>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<!-- Testing -->
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
|
||||||
<version>3.5.3</version>
|
|
||||||
<configuration>
|
|
||||||
<includes>
|
|
||||||
<include>**/*Test.java</include>
|
|
||||||
</includes>
|
|
||||||
<excludes>
|
|
||||||
<exclude>**/IntegrationTest.java</exclude>
|
|
||||||
</excludes>
|
|
||||||
<parallel>classes</parallel>
|
|
||||||
<threadCount>4</threadCount>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
|
|
||||||
<!-- JAR creation -->
|
<!-- JAR creation -->
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-shade-plugin</artifactId>
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
<version>3.6.0</version>
|
<version>3.2.4</version>
|
||||||
<configuration>
|
|
||||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
|
||||||
</configuration>
|
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<phase>package</phase>
|
<phase>package</phase>
|
||||||
|
|
@ -118,10 +98,6 @@
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-pmd-plugin</artifactId>
|
<artifactId>maven-pmd-plugin</artifactId>
|
||||||
<version>3.26.0</version>
|
<version>3.26.0</version>
|
||||||
<configuration>
|
|
||||||
<failOnViolation>false</failOnViolation>
|
|
||||||
<printFailingErrors>true</printFailingErrors>
|
|
||||||
</configuration>
|
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<phase>verify</phase>
|
<phase>verify</phase>
|
||||||
|
|
@ -130,20 +106,22 @@
|
||||||
</goals>
|
</goals>
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
</plugins>
|
</plugins>
|
||||||
|
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
<reporting>
|
<reporting>
|
||||||
|
|
||||||
<plugins>
|
<plugins>
|
||||||
|
|
||||||
<!-- generate Javadocs via "mvn site" and find them in the site
|
<!-- generate Javadocs via "mvn site" and find them in the site
|
||||||
folder-->
|
folder-->
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-javadoc-plugin</artifactId>
|
<artifactId>maven-javadoc-plugin</artifactId>
|
||||||
<version>3.11.2</version>
|
<version>3.11.1</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<show>private</show>
|
<show>private</show>
|
||||||
<nohelp>true</nohelp>
|
<nohelp>true</nohelp>
|
||||||
|
|
@ -153,7 +131,7 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-checkstyle-plugin</artifactId>
|
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||||
<version>3.6.0</version>
|
<version>3.0.0</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
</plugins>
|
</plugins>
|
||||||
|
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
/.DS_Store
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
/.DS_Store
|
|
||||||
|
|
@ -1,41 +1,20 @@
|
||||||
package de.hs_mannheim.informatik.mvn;
|
package de.hs_mannheim.informatik.mvn;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
|
||||||
public class Main {
|
public class Main {
|
||||||
// Aufruf mit externer Log-Config im gleichen Pfad wie das JAR:
|
private static final Logger LOG = LogManager.getLogger();
|
||||||
// java -Dlog4j.configurationFile=log4j2.xml -jar MvnDemo-0.0.1-SNAPSHOT.jar
|
|
||||||
private static final Logger LOG = LogManager.getLogger(Main.class);
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
LOG.info("Hallo Log4J");
|
LOG.info("Hallo Maven!");break it
|
||||||
|
|
||||||
System.out.println("Hello!");
|
|
||||||
System.out.println(loadText("someText.txt"));
|
|
||||||
System.out.println(new Main().add(3, 4));
|
System.out.println(new Main().add(3, 4));
|
||||||
}
|
}
|
||||||
|
|
||||||
public int add(int a, int b) {
|
public int add(int a, int b) {
|
||||||
LOG.info("a = {}, b = {}", a, b);
|
LOG.info("a = {}, b = {}", a, b);
|
||||||
|
|
||||||
return a + b;
|
return a + b;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String loadText(String filename) {
|
|
||||||
try (InputStream in = Main.class.getClassLoader().getResourceAsStream(filename);
|
|
||||||
BufferedReader reader = new BufferedReader(new InputStreamReader(in))) {
|
|
||||||
|
|
||||||
return reader.readLine();
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,17 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<Configuration xmlns="https://logging.apache.org/xml/ns"
|
<Configuration status="WARN">
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="https://logging.apache.org/xml/ns https://logging.apache.org/xml/ns/log4j-config-2.xsd">
|
|
||||||
<Appenders>
|
<Appenders>
|
||||||
<!-- Console appender configuration -->
|
<!-- Konsole Appender -->
|
||||||
<Console name="console" target="SYSTEM_OUT">
|
<Console name="Console" target="SYSTEM_OUT">
|
||||||
<PatternLayout
|
<PatternLayout
|
||||||
pattern="%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n" />
|
pattern="%d{yyyy-MM-dd HH:mm:ss} [%t] %-5level %C{1} - %msg%n" />
|
||||||
</Console>
|
</Console>
|
||||||
</Appenders>
|
</Appenders>
|
||||||
|
|
||||||
<Loggers>
|
<Loggers>
|
||||||
<!-- Root logger referring to console appender -->
|
<!-- Root Logger -->
|
||||||
<Root level="INFO" additivity="false">
|
<Root level="info">
|
||||||
<AppenderRef ref="console" />
|
<AppenderRef ref="Console" />
|
||||||
</Root>
|
</Root>
|
||||||
</Loggers>
|
</Loggers>
|
||||||
</Configuration>
|
</Configuration>
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
Hallo Maven!
|
|
||||||
|
|
@ -6,13 +6,8 @@ import org.junit.jupiter.api.Test;
|
||||||
class AddTest {
|
class AddTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testAdd() {
|
void test() {
|
||||||
assertEquals(7, new Main().add(3, 4));
|
assertEquals(7, new Main().add(3, 4));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
void testLoader() {
|
|
||||||
assertEquals("Test Text", Main.loadText("test.txt"));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
Test Text
|
|
||||||
Loading…
Reference in New Issue