Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci-build-manual-crf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ jobs:
with:
fetch-tags: true
fetch-depth: 0
- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '17.0.10+7'
java-version: '21'
distribution: 'temurin'
cache: 'gradle'
- name: Build with Gradle
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci-build-manual-eval.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '17.0.10+7'
java-version: '21'
distribution: 'temurin'
cache: 'gradle'
- name: Build with Gradle
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci-build-manual-full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ jobs:
with:
fetch-tags: true
fetch-depth: 0
- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '17.0.10+7'
java-version: '21'
distribution: 'temurin'
cache: 'gradle'
- name: Build with Gradle
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci-build-unstable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Set up JDK 11
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'adopt'
java-version: '21'
distribution: 'temurin'
cache: 'gradle'
- name: Build with Gradle
run: ./gradlew clean assemble --info --stacktrace --no-daemon
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile.crf
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# -------------------
# build builder image
# -------------------
FROM eclipse-temurin:17.0.15_6-jdk AS builder
FROM eclipse-temurin:21-jdk AS builder

USER root

Expand Down Expand Up @@ -66,7 +66,7 @@ RUN rm -rf grobid-source
# -------------------
# build runtime image
# -------------------
FROM eclipse-temurin:17.0.15_6-jre
FROM eclipse-temurin:21-jre

RUN apt-get update && \
apt-get -y upgrade && \
Expand Down
7 changes: 4 additions & 3 deletions Dockerfile.delft
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# build builder image
# -------------------

FROM eclipse-temurin:17.0.15_6-jdk AS builder
FROM eclipse-temurin:21-jdk AS builder

USER root

Expand Down Expand Up @@ -122,8 +122,9 @@ COPY --from=builder /opt/java/openjdk ${JAVA_HOME}
# install jep
RUN pip3 install jep==4.0.3


ENV LD_LIBRARY_PATH=/usr/local/lib/python3.8/dist-packages/jep:grobid-home/lib/lin-64:grobid-home/lib/lin-64/jep:${LD_LIBRARY_PATH}
# Get the Python version dynamically and set LD_LIBRARY_PATH accordingly
ENV PYTHON_VERSION=$(python3 --version | cut -d' ' -f2 | cut -d'.' -f1,2)
ENV LD_LIBRARY_PATH=/usr/local/lib/python${PYTHON_VERSION}/dist-packages/jep:grobid-home/lib/lin-64:grobid-home/lib/lin-64/jep:${LD_LIBRARY_PATH}
# remove libjep.so because we are providing our own version in the virtual env above
RUN rm /opt/grobid/grobid-home/lib/lin-64/jep/libjep.so

Expand Down
7 changes: 4 additions & 3 deletions Dockerfile.evaluation
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# build builder image
# -------------------

FROM eclipse-temurin:17.0.15_6-jdk AS builder
FROM eclipse-temurin:21-jdk AS builder

USER root

Expand Down Expand Up @@ -115,8 +115,9 @@ COPY --from=builder /opt/java/openjdk ${JAVA_HOME}
# install jep
RUN pip3 install jep==4.0.3


ENV LD_LIBRARY_PATH=/usr/local/lib/python3.8/dist-packages/jep:grobid-home/lib/lin-64:grobid-home/lib/lin-64/jep:${LD_LIBRARY_PATH}
# Get the Python version dynamically and set LD_LIBRARY_PATH accordingly
ENV PYTHON_VERSION=$(python3 --version | cut -d' ' -f2 | cut -d'.' -f1,2)
ENV LD_LIBRARY_PATH=/usr/local/lib/python${PYTHON_VERSION}/dist-packages/jep:grobid-home/lib/lin-64:grobid-home/lib/lin-64/jep:${LD_LIBRARY_PATH}
# remove libjep.so because we are providing our own version in the virtual env above
RUN rm /opt/grobid/grobid-home/lib/lin-64/jep/libjep.so

Expand Down
96 changes: 45 additions & 51 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,19 +1,9 @@
buildscript {
repositories {
mavenLocal()
mavenCentral()
maven {
url 'https://plugins.gradle.org/m2/'
}
gradlePluginPortal()
}
dependencies {
classpath 'gradle.plugin.org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.12.0'
classpath "gradle.plugin.com.github.jengelman.gradle.plugins:shadow:7.0.0"
classpath 'com.adarshr:gradle-test-logger-plugin:2.0.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.21"
classpath "net.researchgate:gradle-release:3.0.2"
}
plugins {
id 'org.jetbrains.kotlin.jvm' version '2.0.0' apply false
id 'com.gradleup.shadow' version '8.3.8' apply false
id 'com.adarshr.test-logger' version '4.0.0' apply false
id 'com.github.kt3k.coveralls' version '2.12.2' apply false
id 'net.researchgate.release' version '3.1.0' apply false
}

repositories {
Expand Down Expand Up @@ -59,6 +49,7 @@ def getJavaLibraryPath = {
}

apply plugin: 'jacoco'
apply plugin: 'com.github.kt3k.coveralls'

jacoco {
toolVersion = '0.8.8'
Expand All @@ -70,7 +61,7 @@ def getGitRevision() {
try {
def stdout = new ByteArrayOutputStream()
println("Checking git under ${rootProject.rootDir}")
exec {
project.exec {
workingDir rootProject.rootDir
commandLine 'git', 'describe', '--tags', '--always', '--first-parent'
standardOutput = stdout
Expand All @@ -94,11 +85,6 @@ tasks.register('collectGitRevision') {
}

allprojects {
apply plugin: 'java-library'
apply plugin: 'base'
apply plugin: 'com.github.kt3k.coveralls'
apply plugin: 'com.adarshr.test-logger'
apply plugin: 'org.jetbrains.kotlin.jvm'
apply plugin: 'net.researchgate.release'

group = "org.grobid"
Expand All @@ -114,6 +100,8 @@ allprojects {
subprojects {
apply plugin: 'java'
apply plugin: 'maven-publish'
apply plugin: 'org.jetbrains.kotlin.jvm'
apply plugin: 'com.adarshr.test-logger'

publishing {
publications {
Expand All @@ -127,14 +115,15 @@ subprojects {
}
}

sourceCompatibility = 1.11
targetCompatibility = 1.11
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}

tasks.withType(KotlinCompile).configureEach {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
kotlinOptions {
jvmTarget = JavaVersion.VERSION_11
jvmTarget = "21"
}
}

Expand All @@ -149,7 +138,6 @@ subprojects {
configurations {
all*.exclude group: 'org.slf4j', module: "slf4j-log4j12"
all*.exclude group: 'log4j', module: "log4j"
implementation.setCanBeResolved(true)
}

ext {
Expand All @@ -173,9 +161,9 @@ subprojects {
because("Only needed to run tests in a version of IntelliJ IDEA that bundles older versions")
}
testImplementation('org.junit.jupiter:junit-jupiter')
testImplementation 'org.easymock:easymock:5.1.0'
testImplementation "org.powermock:powermock-api-easymock:2.0.7"
testImplementation "org.powermock:powermock-module-junit4:2.0.7"
testImplementation 'org.easymock:easymock:5.6.0'
testImplementation "org.powermock:powermock-api-easymock:2.0.9"
testImplementation "org.powermock:powermock-module-junit4:2.0.9"
testImplementation "org.xmlunit:xmlunit-matchers:2.10.0"
testImplementation "org.xmlunit:xmlunit-legacy:2.10.0"
testImplementation "org.hamcrest:hamcrest-all:1.3"
Expand Down Expand Up @@ -203,15 +191,15 @@ subprojects {
tasks.register('sourceJar', Jar) {
description = 'A jar that contains source code'
archiveClassifier = 'sources'
from project.sourceSets.main.java
from sourceSets.main.allSource
}

artifacts {
archives sourceJar
archives jar
}

test {
tasks.withType(Test) {
useJUnitPlatform()

testLogging.showStandardStreams = true
Expand All @@ -223,7 +211,11 @@ subprojects {

if (JavaVersion.current().compareTo(JavaVersion.VERSION_1_8) > 0) {
jvmArgs "--add-opens", "java.base/java.util.stream=ALL-UNNAMED",
"--add-opens", "java.base/java.io=ALL-UNNAMED", "--add-opens", "java.xml/jdk.xml.internal=ALL-UNNAMED"
"--add-opens", "java.base/java.io=ALL-UNNAMED",
"--add-opens", "java.xml/jdk.xml.internal=ALL-UNNAMED",
// PowerMock compatibility with Java 21 - TODO: Replace PowerMock with Mockito/JUnit Jupiter
"--add-opens", "java.base/java.lang=ALL-UNNAMED",
"--add-opens", "java.base/java.util=ALL-UNNAMED"
}

systemProperty "java.library.path", "${javaLibraryPath}"
Expand All @@ -233,7 +225,7 @@ subprojects {
/** SUBPROJECTS **/

project("grobid-core") {
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'com.gradleup.shadow'
apply plugin: 'jacoco'

configurations {
Expand Down Expand Up @@ -351,9 +343,11 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
project(":grobid-service") {
apply plugin: 'application'
apply plugin: 'jacoco'
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'com.gradleup.shadow'

mainClassName = 'org.grobid.service.main.GrobidServiceApplication'
application {
mainClass = 'org.grobid.service.main.GrobidServiceApplication'
}


tasks.run {
Expand Down Expand Up @@ -436,7 +430,7 @@ project(":grobid-service") {
}

project(":grobid-trainer") {
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'com.gradleup.shadow'
apply plugin: 'jacoco'

dependencies {
Expand Down Expand Up @@ -541,7 +535,7 @@ project(":grobid-trainer") {

trainerTasks.each { taskName, mainClassName ->
tasks.create(name: taskName, type: JavaExec, group: 'modeltraining') {
main = mainClassName
mainClass = mainClassName
classpath = sourceSets.main.runtimeClasspath
def javaLibraryPath = getJavaLibraryPath()
if (JavaVersion.current().compareTo(JavaVersion.VERSION_1_8) > 0) {
Expand All @@ -555,7 +549,7 @@ project(":grobid-trainer") {

complexTrainerTasks.each { taskName, mainClassNameAndArgs ->
tasks.create(name: taskName, type: JavaExec, group: 'modeltraining') {
main = mainClassNameAndArgs[0]
mainClass = mainClassNameAndArgs[0]
classpath = sourceSets.main.runtimeClasspath
def javaLibraryPath = getJavaLibraryPath()
if (JavaVersion.current().compareTo(JavaVersion.VERSION_1_8) > 0) {
Expand All @@ -580,7 +574,7 @@ project(":grobid-trainer") {
// ./gradlew PrepareDOIMatching -Pp2t=ABS_PATH_TO_PMC/PMC_sample_1943
// ./gradlew EvaluateDOIMatching -Pp2t=ABS_PATH_TO_PMC/PMC_sample_1943
task(jatsEval, dependsOn: 'classes', type: JavaExec, group: 'modelevaluation') {
main = 'org.grobid.trainer.evaluation.EndToEndEvaluation'
mainClass = 'org.grobid.trainer.evaluation.EndToEndEvaluation'
classpath = sourceSets.main.runtimeClasspath
args 'nlm', getArg('p2t', '.'), getArg('run', '0'), getArg('fileRatio', '1.0'), getArg('flavor', '')
def javaLibraryPath = getJavaLibraryPath()
Expand All @@ -593,7 +587,7 @@ project(":grobid-trainer") {
}

task(teiEval, dependsOn: 'classes', type: JavaExec, group: 'modelevaluation') {
main = 'org.grobid.trainer.evaluation.EndToEndEvaluation'
mainClass = 'org.grobid.trainer.evaluation.EndToEndEvaluation'
classpath = sourceSets.main.runtimeClasspath
args 'tei', getArg('p2t', '.'), getArg('run', '0'), getArg('fileRatio', '1.0'), getArg('flavor', '')
def javaLibraryPath = getJavaLibraryPath()
Expand All @@ -607,7 +601,7 @@ project(":grobid-trainer") {
}

task(PrepareDOIMatching, dependsOn: 'classes', type: JavaExec, group: 'modelevaluation') {
main = 'org.grobid.trainer.evaluation.EvaluationDOIMatching'
mainClass = 'org.grobid.trainer.evaluation.EvaluationDOIMatching'
classpath = sourceSets.main.runtimeClasspath
args 'data', getArg('p2t', '.')
def javaLibraryPath = getJavaLibraryPath()
Expand All @@ -622,7 +616,7 @@ project(":grobid-trainer") {
}

task(EvaluateDOIMatching, dependsOn: 'classes', type: JavaExec, group: 'modelevaluation') {
main = 'org.grobid.trainer.evaluation.EvaluationDOIMatching'
mainClass = 'org.grobid.trainer.evaluation.EvaluationDOIMatching'
classpath = sourceSets.main.runtimeClasspath
args 'eval', getArg('p2t', '.')

Expand Down Expand Up @@ -662,24 +656,24 @@ tasks.register("codeCoverageReport", JacocoReport) {
// XML -> coveralls,
// HTML -> for manual check
reports {
xml.enabled true
html.enabled true
csv.enabled true
xml.required = true
html.required = true
csv.required = true
}

}

/** COVERALLS **/
coveralls {
sourceDirs = files(subprojects.sourceSets.main.allSource.srcDirs).files.absolutePath
sourceDirs = files(subprojects.findAll { it.plugins.hasPlugin('java') }.sourceSets.main.allSource.srcDirs).files.absolutePath
}

tasks.coveralls {
dependsOn codeCoverageReport
}

wrapper {
gradleVersion "7.2"
gradleVersion "9.0.0"
}

build.dependsOn project.getSubprojects().collect({ it.getTasks().getByName("build") })
Expand All @@ -691,4 +685,4 @@ release {
git {
requireBranch.set('master')
}
}
}
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 3 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.0.0-bin.zip
networkTimeout=10000
validateDistributionUrl=true
Comment on lines +4 to +5
Copy link

Copilot AI Aug 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider adding a comment explaining the purpose of the 10-second network timeout, as this configuration may not be immediately clear to other developers.

Suggested change
networkTimeout=10000
validateDistributionUrl=true

Copilot uses AI. Check for mistakes.
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists