Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrated Build System to Gradle 8.9 and Java 17 #186

Merged
merged 4 commits into from
Aug 16, 2024

Conversation

javadev
Copy link
Contributor

@javadev javadev commented Aug 12, 2024

This is the new Gradle script, but it currently doesn't include Checkstyle.

@fishercoder1534
Copy link
Owner

Thanks for the effort, is it possible to add any basic checkStyle as well?

@javadev
Copy link
Contributor Author

javadev commented Aug 12, 2024

I have example with checkstyle gradle plugin

plugins {
    id 'java'
    id 'checkstyle' // Apply the Checkstyle plugin
}

group = 'com.fishercoder'
version = '1.0-SNAPSHOT'

java {
    toolchain {
        languageVersion = JavaLanguageVersion.of(17)
    }
}

tasks.javadoc {
    options.encoding = 'UTF-8'
}

tasks.compileJava {
    options.encoding = 'UTF-8'
}

repositories {
    mavenCentral()
}

dependencies {
    implementation 'com.google.code.gson:gson:2.10.1'
    implementation 'org.apache.commons:commons-collections4:4.0'

    testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.3'
    testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.3'

    testImplementation 'org.assertj:assertj-core:3.11.1'
    compileOnly 'org.projectlombok:lombok:1.18.32'
    annotationProcessor 'org.projectlombok:lombok:1.18.32'
    testCompileOnly 'org.projectlombok:lombok:1.18.32'
    testAnnotationProcessor 'org.projectlombok:lombok:1.18.32'
}

testing {
    suites {
        test {
            useJUnitJupiter()
        }
    }
}

tasks.withType(Test).configureEach {
    maxParallelForks = Runtime.runtime.availableProcessors()
}

// Configure Checkstyle
checkstyle {
    toolVersion = '10.12.0' // Set Checkstyle version
    config = rootProject.resources.text.fromFile('config/checkstyle/checkstyle.xml') // Path to Checkstyle configuration file
}

tasks.checkstyleMain {
    reports {
        xml.required.set(false) // Disable XML report
        html.required.set(true)  // Enable HTML report
    }
}

tasks.checkstyleTest {
    reports {
        xml.required.set(false) // Disable XML report
        html.required.set(true)  // Enable HTML report
    }
}

@javadev
Copy link
Contributor Author

javadev commented Aug 12, 2024

Could you please let me know which checkstyle tool version is currently being used?

@javadev
Copy link
Contributor Author

javadev commented Aug 13, 2024

I've added Checkstyle version 6.17.

@fishercoder1534 fishercoder1534 merged commit 29f7c04 into fishercoder1534:master Aug 16, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants