Skip to content

Commit 390c4b0

Browse files
committed
Gradle-ify the project to prepare for multi-module publishing
1 parent c25a88d commit 390c4b0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+371
-40
lines changed

.editorconfig

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ charset = utf-8
99
indent_style = space
1010
indent_size = 4
1111

12-
[.github/workflows/*.yml]
12+
[*.yml]
1313
indent_size = 2

.github/dependabot.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version: 2
22
updates:
3-
- package-ecosystem: maven
4-
directory: "/"
5-
schedule:
6-
interval: daily
7-
open-pull-requests-limit: 10
3+
- package-ecosystem: maven
4+
directory: "/"
5+
schedule:
6+
interval: daily
7+
open-pull-requests-limit: 10

.github/workflows/pr.yml

+3-4
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,9 @@ jobs:
1313
with:
1414
distribution: temurin
1515
java-version: '17'
16-
cache: maven
16+
cache: gradle
1717

1818
- name: 🏗️ Build & test
1919
run: |
20-
mvn -version
21-
export MAVEN_HOME="$(whereis mvn)"
22-
mvn clean verify -Dorg.slf4j.simpleLogger.showDateTime=true "-Dorg.slf4j.simpleLogger.dateTimeFormat=yyyy-MM-dd HH:mm:ss"
20+
./gradlew --version --no-daemon
21+
./gradlew clean publishToMavenLocal -i --no-daemon --warning-mode all

.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# Maven
12
target/
23
pom.xml.tag
34
pom.xml.releaseBackup
@@ -10,6 +11,11 @@ buildNumber.properties
1011
# https://github.com/takari/maven-wrapper#usage-without-binary-jar
1112
.mvn/wrapper/maven-wrapper.jar
1213

14+
# Gradle
15+
.gradle/
16+
build/
17+
gradle/libs.versions.toml
18+
1319
# IntelliJ
1420
.idea/
1521
*.iml

.travis.yml

-21
This file was deleted.

README.md

+24-7

build.gradle.kts

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
group = "com.github.fridujo"
2+
version = "1.0.1-SNAPSHOT"
3+
description = "classpath-junit-extension"
4+
5+
allprojects {
6+
repositories {
7+
mavenLocal()
8+
mavenCentral()
9+
}
10+
11+
apply {
12+
plugin("base")
13+
}
14+
15+
tasks.withType<JavaCompile> {
16+
options.encoding = "UTF-8"
17+
}
18+
19+
tasks.withType<Javadoc> {
20+
options.encoding = "UTF-8"
21+
(options as CoreJavadocOptions).addStringOption("Xdoclint:all,-missing", "-quiet")
22+
}
23+
24+
tasks.withType<Test> {
25+
useJUnitPlatform()
26+
}
27+
}
28+
29+
subprojects {
30+
apply {
31+
plugin("java")
32+
plugin("java-library")
33+
}
34+
}
+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
plugins {
2+
`maven-publish`
3+
}
4+
5+
group = "com.github.fridujo"
6+
version = "1.0.1-SNAPSHOT"
7+
8+
java {
9+
withSourcesJar()
10+
withJavadocJar()
11+
}
12+
13+
publishing {
14+
publications.create<MavenPublication>("maven") {
15+
from(components["java"])
16+
}
17+
}
18+
19+
dependencies {
20+
compileOnly(libs.org.apache.maven.resolver.maven.resolver.api)
21+
compileOnly(libs.org.apache.maven.resolver.maven.resolver.spi)
22+
compileOnly(libs.org.apache.maven.resolver.maven.resolver.impl)
23+
compileOnly(libs.org.junit.jupiter.junit.jupiter.api)
24+
25+
api(libs.ch.qos.logback.logback.classic)
26+
api(libs.eu.maveniverse.maven.mima.context)
27+
api(libs.com.fasterxml.jackson.dataformat.jackson.dataformat.xml)
28+
29+
runtimeOnly(libs.eu.maveniverse.maven.mima.runtime.standalone.static)
30+
31+
testImplementation(libs.org.junit.jupiter.junit.jupiter)
32+
testImplementation(libs.org.assertj.assertj.core)
33+
testImplementation(libs.org.mockito.mockito.core)
34+
testImplementation(libs.com.google.guava.guava)
35+
}

src/main/java/com/github/fridujo/classpath/junit/extension/PathElement.java renamed to classpath-junit-extension/src/main/java/com/github/fridujo/classpath/junit/extension/PathElement.java

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ private PathElement(String rawPath) {
1919
public static PathElement create(String rawPath) {
2020
String normalizedRawPath = rawPath;
2121

22+
normalizedRawPath = normalizedRawPath.replace("\\\\", "\\");
23+
2224
boolean directory = Files.isDirectory(Paths.get(rawPath));
2325
boolean alreadyHasTerminalSlash = rawPath.trim().endsWith(File.separator);
2426
if (directory && !alreadyHasTerminalSlash) {

src/main/java/com/github/fridujo/classpath/junit/extension/jupiter/ModifiedClasspath.java renamed to classpath-junit-extension/src/main/java/com/github/fridujo/classpath/junit/extension/jupiter/ModifiedClasspath.java

-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
* <li><b>groupId:artifactId:version</b></li>
2828
* </ul>
2929
* <p>
30-
* <p>
3130
* In opposition to {@link #excludeDependencies()}, their will be no attempt to list and exclude dependencies.
3231
*/
3332
String[] excludeJars() default {};

src/test/java/com/github/fridujo/classpath/junit/extension/ClasspathExclusionTests.java renamed to classpath-junit-extension/src/test/java/com/github/fridujo/classpath/junit/extension/ClasspathExclusionTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ void exclusion_of_multiple_gavs_and_their_dependencies() {
2424
}
2525

2626
@Test
27-
@ModifiedClasspath(excludeDependencies = "guava:guava")
27+
@ModifiedClasspath(excludeDependencies = "com.google.guava:guava")
2828
void exclusion_of_one_gav_and_its_dependencies() {
2929
assertThatExceptionOfType(ClassNotFoundException.class)
3030
.isThrownBy(() -> Class.forName("com.google.common.collect.Maps"));

gradle.properties

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
sourceCompatibility=17

gradle/wrapper/gradle-wrapper.jar

42.4 KB
Binary file not shown.
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
4+
networkTimeout=10000
5+
validateDistributionUrl=true
6+
zipStoreBase=GRADLE_USER_HOME
7+
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)