Skip to content

Commit c8e48ba

Browse files
committed
add Maven examples
Signed-off-by: Manfred Hanke <Manfred.Hanke@tngtech.com>
1 parent 3246861 commit c8e48ba

File tree

6 files changed

+148
-9
lines changed

6 files changed

+148
-9
lines changed

README.md

+11-7
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,17 @@ All example rules you find within `src/test` refer to classes from `src/main`.
1212
These tests are all designed to fail, to demonstrate how production code could violate
1313
typical architectural constraints (like layer dependencies).
1414

15-
You can run them with Gradle
16-
17-
```
18-
./gradlew build
19-
```
20-
21-
Otherwise the tests can be run directly from any IDE.
15+
You can run them
16+
17+
* with Gradle
18+
```sh
19+
./gradlew test
20+
```
21+
* with Maven
22+
```sh
23+
mvn test
24+
```
25+
* or directly from your IDE.
2226

2327
## Regarding issues
2428

example-junit4/pom.xml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
4+
<modelVersion>4.0.0</modelVersion>
5+
<parent>
6+
<groupId>com.tngtech.archunit</groupId>
7+
<artifactId>archunit-examples</artifactId>
8+
<version>1.4.0</version>
9+
</parent>
10+
<artifactId>archunit-example-junit4</artifactId>
11+
<dependencies>
12+
<dependency>
13+
<groupId>com.tngtech.archunit</groupId>
14+
<artifactId>archunit-junit4</artifactId>
15+
<version>1.4.0</version>
16+
<scope>test</scope>
17+
</dependency>
18+
</dependencies>
19+
</project>

example-junit5/pom.xml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
4+
<modelVersion>4.0.0</modelVersion>
5+
<parent>
6+
<groupId>com.tngtech.archunit</groupId>
7+
<artifactId>archunit-examples</artifactId>
8+
<version>1.4.0</version>
9+
</parent>
10+
<artifactId>archunit-example-junit5</artifactId>
11+
<dependencies>
12+
<dependency>
13+
<groupId>com.tngtech.archunit</groupId>
14+
<artifactId>archunit-junit5</artifactId>
15+
<version>1.4.0</version>
16+
<scope>test</scope>
17+
</dependency>
18+
</dependencies>
19+
</project>

example-plain/build.gradle

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
dependencies {
2-
testImplementation 'junit:junit:4.12' // We will use JUnit to run the tests, but for this example it is irrelevant, might as well be TestNG
3-
2+
testImplementation 'junit:junit:4.13.2' // We will use JUnit to run the tests, but for this example it is irrelevant, might as well be TestNG
43
testImplementation 'com.tngtech.archunit:archunit:1.4.0'
54
}

example-plain/pom.xml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
4+
<modelVersion>4.0.0</modelVersion>
5+
<parent>
6+
<groupId>com.tngtech.archunit</groupId>
7+
<artifactId>archunit-examples</artifactId>
8+
<version>1.4.0</version>
9+
</parent>
10+
<artifactId>archunit-example-plain</artifactId>
11+
<dependencies>
12+
<dependency> <!-- We will use JUnit to run the tests, but for this example it is irrelevant, might as well be TestNG -->
13+
<groupId>junit</groupId>
14+
<artifactId>junit</artifactId>
15+
<version>4.13.2</version>
16+
<scope>test</scope>
17+
</dependency>
18+
<dependency>
19+
<groupId>com.tngtech.archunit</groupId>
20+
<artifactId>archunit</artifactId>
21+
<version>1.4.0</version>
22+
<scope>test</scope>
23+
</dependency>
24+
</dependencies>
25+
</project>

pom.xml

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
4+
<modelVersion>4.0.0</modelVersion>
5+
<groupId>com.tngtech.archunit</groupId>
6+
<artifactId>archunit-examples</artifactId>
7+
<version>1.4.0</version>
8+
<packaging>pom</packaging>
9+
<dependencies>
10+
<dependency>
11+
<groupId>com.google.inject</groupId>
12+
<artifactId>guice</artifactId>
13+
<version>5.1.0</version>
14+
</dependency>
15+
<dependency>
16+
<groupId>jakarta.annotation</groupId>
17+
<artifactId>jakarta.annotation-api</artifactId>
18+
<version>2.1.1</version>
19+
</dependency>
20+
<dependency>
21+
<groupId>jakarta.inject</groupId>
22+
<artifactId>jakarta.inject-api</artifactId>
23+
<version>2.0.1</version>
24+
</dependency>
25+
<dependency>
26+
<groupId>javax.annotation</groupId>
27+
<artifactId>javax.annotation-api</artifactId>
28+
<version>1.3.2</version>
29+
</dependency>
30+
<dependency>
31+
<groupId>joda-time</groupId>
32+
<artifactId>joda-time</artifactId>
33+
<version>2.12.7</version>
34+
</dependency>
35+
<dependency>
36+
<groupId>org.apache.geronimo.specs</groupId>
37+
<artifactId>geronimo-ejb_3.1_spec</artifactId>
38+
<version>1.0.2</version>
39+
</dependency>
40+
<dependency>
41+
<groupId>org.apache.geronimo.specs</groupId>
42+
<artifactId>geronimo-jpa_2.0_spec</artifactId>
43+
<version>1.1</version>
44+
</dependency>
45+
<dependency>
46+
<groupId>org.springframework</groupId>
47+
<artifactId>spring-beans</artifactId>
48+
<version>5.3.23</version>
49+
</dependency>
50+
</dependencies>
51+
<build>
52+
<plugins>
53+
<plugin>
54+
<groupId>org.apache.maven.plugins</groupId>
55+
<artifactId>maven-compiler-plugin</artifactId>
56+
<configuration>
57+
<source>1.8</source>
58+
<target>1.8</target>
59+
</configuration>
60+
</plugin>
61+
<plugin>
62+
<groupId>org.apache.maven.plugins</groupId>
63+
<artifactId>maven-surefire-plugin</artifactId>
64+
<version>3.5.2</version>
65+
</plugin>
66+
</plugins>
67+
</build>
68+
<modules>
69+
<module>example-junit4</module>
70+
<module>example-junit5</module>
71+
<module>example-plain</module>
72+
</modules>
73+
</project>

0 commit comments

Comments
 (0)