Skip to content

Commit 4b21509

Browse files
committed
init commit
1 parent 516d4df commit 4b21509

File tree

6 files changed

+113
-38
lines changed

6 files changed

+113
-38
lines changed

README.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
## Overview
2-
Repository creates for fast running development process with configuration, which are the same from project to project.
3-
2+
Example of configurations for Executable jar.
43
## Building
5-
...
4+
Run next commands:
5+
6+
1. `cd ${projectDir}`
7+
2. `mvn clean package`
8+
3. `cd target`
9+
4. `java -jar executable-jar-1.0-jar-with-dependencies.jar`
10+
11+
the result would:
12+
13+
`Hello world, executable-jar-example!`
614

715
## Troubleshooting
816
...

pom.xml

Lines changed: 65 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,76 @@
55
<modelVersion>4.0.0</modelVersion>
66

77
<groupId>com.github.romankh3</groupId>
8-
<artifactId>maven-template-repository</artifactId>
9-
<version>1.0-SNAPSHOT</version>
8+
<artifactId>executable-jar</artifactId>
9+
<version>1.0</version>
10+
11+
<properties>
12+
<compiler.plugin.version>3.8.1</compiler.plugin.version>
13+
<assembly.plugin.version>3.2.0</assembly.plugin.version>
14+
<java.version>1.8</java.version>
15+
<apache.commons.version>3.9</apache.commons.version>
16+
<junit.version>5.6.0</junit.version>
17+
</properties>
1018

1119
<dependencies>
20+
<!-- Added to be sure, that jat would with dependencies -->
1221
<dependency>
13-
<groupId>junit</groupId>
14-
<artifactId>junit</artifactId>
15-
<version>4.12</version>
22+
<groupId>org.apache.commons</groupId>
23+
<artifactId>commons-lang3</artifactId>
24+
<version>${apache.commons.version}</version>
25+
</dependency>
26+
27+
<!-- TEST -->
28+
<dependency>
29+
<groupId>org.junit.jupiter</groupId>
30+
<artifactId>junit-jupiter-params</artifactId>
31+
<version>${junit.version}</version>
32+
<scope>test</scope>
33+
</dependency>
34+
35+
<dependency>
36+
<groupId>org.junit.jupiter</groupId>
37+
<artifactId>junit-jupiter-engine</artifactId>
38+
<version>${junit.version}</version>
1639
<scope>test</scope>
1740
</dependency>
1841
</dependencies>
1942

43+
<build>
44+
<plugins>
45+
<plugin>
46+
<groupId>org.apache.maven.plugins</groupId>
47+
<artifactId>maven-compiler-plugin</artifactId>
48+
<version>${compiler.plugin.version}</version>
49+
<configuration>
50+
<source>${java.version}</source>
51+
<target>${java.version}</target>
52+
</configuration>
53+
</plugin>
54+
<plugin>
55+
<groupId>org.apache.maven.plugins</groupId>
56+
<artifactId>maven-assembly-plugin</artifactId>
57+
<version>${assembly.plugin.version}</version>
58+
<executions>
59+
<execution>
60+
<phase>package</phase>
61+
<goals>
62+
<goal>single</goal>
63+
</goals>
64+
</execution>
65+
</executions>
66+
<configuration>
67+
<descriptorRefs>
68+
<descriptorRef>jar-with-dependencies</descriptorRef>
69+
</descriptorRefs>
70+
<archive>
71+
<manifest>
72+
<mainClass>com.github.romankh3.executablejar.ExecutableJarExample</mainClass>
73+
</manifest>
74+
</archive>
75+
</configuration>
76+
</plugin>
77+
</plugins>
78+
</build>
79+
2080
</project>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package com.github.romankh3.executablejar;
2+
3+
import org.apache.commons.lang3.StringUtils;
4+
5+
/**
6+
* Main class for Maven Executable Jar.
7+
*/
8+
public class ExecutableJarExample {
9+
10+
public static final String JAVA_REPOSITORY_TEMPLATE = "executable-jar-example";
11+
12+
public static void main(String[] args) {
13+
// added if to use library from classpath to be sure
14+
// that jar gets dependencies
15+
if(StringUtils.isNoneEmpty(JAVA_REPOSITORY_TEMPLATE)) {
16+
System.out.println(String.format("Hello world, %s!",JAVA_REPOSITORY_TEMPLATE));
17+
}
18+
}
19+
}

src/main/java/com/github/romankh3/maventemplaterepository/MavenTemplateRepository.java

Lines changed: 0 additions & 13 deletions
This file was deleted.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package com.github.romankh3.executablejar;
2+
3+
import static org.junit.jupiter.api.Assertions.assertNotNull;
4+
5+
import org.junit.jupiter.api.Test;
6+
7+
/**
8+
* Unit-level testing for {@link ExecutableJarExample} object.
9+
*/
10+
public class ExecutableJarExampleTest {
11+
12+
@Test
13+
public void shouldCreateJavaRepositoryTemplateMain() {
14+
ExecutableJarExample main = new ExecutableJarExample();
15+
assertNotNull(main);
16+
}
17+
18+
}

src/test/java/com/github/romankh3/maventemplaterepository/MavenTemplateRepositoryTest.java

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)