update to Gradle 8.1.1, block long running tests, block tests with locked ports
This commit is contained in:
parent
19f02c350d
commit
47972552c8
31 changed files with 269 additions and 145 deletions
29
build.gradle
29
build.gradle
|
@ -1,6 +1,12 @@
|
|||
|
||||
plugins {
|
||||
id "de.marcphilipp.nexus-publish" version "0.4.0"
|
||||
id "io.codearte.nexus-staging" version "0.21.1"
|
||||
id "checkstyle"
|
||||
id "pmd"
|
||||
id 'maven-publish'
|
||||
id 'signing'
|
||||
id "io.github.gradle-nexus.publish-plugin" version "1.3.0"
|
||||
id "com.github.spotbugs" version "5.0.14"
|
||||
id "org.cyclonedx.bom" version "1.7.2"
|
||||
}
|
||||
|
||||
wrapper {
|
||||
|
@ -13,10 +19,10 @@ ext {
|
|||
name = 'oai'
|
||||
description = 'Open Archive Initiative library for Java'
|
||||
inceptionYear = '2016'
|
||||
url = 'https://github.com/' + user + '/' + name
|
||||
scmUrl = 'https://github.com/' + user + '/' + name
|
||||
scmConnection = 'scm:git:git://github.com/' + user + '/' + name + '.git'
|
||||
scmDeveloperConnection = 'scm:git:ssh://git@github.com:' + user + '/' + name + '.git'
|
||||
url = 'https://xbib.org/' + user + '/' + name
|
||||
scmUrl = 'https://xbib.org/' + user + '/' + name
|
||||
scmConnection = 'scm:git:git://xbib.org/' + user + '/' + name + '.git'
|
||||
scmDeveloperConnection = 'scm:git:ssh://forgejo@xbib.org:' + user + '/' + name + '.git'
|
||||
issueManagementSystem = 'Github'
|
||||
issueManagementUrl = ext.scmUrl + '/issues'
|
||||
licenseName = 'The Apache License, Version 2.0'
|
||||
|
@ -24,11 +30,14 @@ ext {
|
|||
}
|
||||
|
||||
subprojects {
|
||||
apply plugin: 'java-library'
|
||||
apply from: rootProject.file('gradle/ide/idea.gradle')
|
||||
apply from: rootProject.file('gradle/repositories/maven.gradle')
|
||||
apply from: rootProject.file('gradle/compile/java.gradle')
|
||||
apply from: rootProject.file('gradle/test/junit5.gradle')
|
||||
apply from: rootProject.file('gradle/publishing/publication.gradle')
|
||||
apply from: rootProject.file('gradle/publish/maven.gradle')
|
||||
apply from: rootProject.file('gradle/quality/checkstyle.gradle')
|
||||
apply from: rootProject.file('gradle/quality/pmd.gradle')
|
||||
apply from: rootProject.file('gradle/quality/spotbugs.gradle')
|
||||
}
|
||||
|
||||
apply from: rootProject.file('gradle/publishing/sonatype.gradle')
|
||||
apply from: rootProject.file('gradle/publish/sonatype.gradle')
|
||||
apply from: rootProject.file('gradle/publish/forgejo.gradle')
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<!DOCTYPE suppressions PUBLIC
|
||||
"-//Puppy Crawl//DTD Suppressions 1.1//EN"
|
||||
"http://www.puppycrawl.com/dtds/suppressions_1_1.dtd">
|
||||
<suppressions>
|
||||
<suppress checks="." files="[\\/]generated-src[\\/].*\.java$"/>
|
||||
</suppressions>
|
|
@ -3,6 +3,8 @@ apply plugin: 'java-library'
|
|||
|
||||
java {
|
||||
modularity.inferModulePath.set(true)
|
||||
withSourcesJar()
|
||||
withJavadocJar()
|
||||
}
|
||||
|
||||
compileJava {
|
||||
|
@ -21,18 +23,12 @@ jar {
|
|||
}
|
||||
}
|
||||
|
||||
task sourcesJar(type: Jar) {
|
||||
dependsOn classes
|
||||
classifier 'sources'
|
||||
from sourceSets.main.allSource
|
||||
tasks.withType(JavaCompile) {
|
||||
options.compilerArgs << '-Xlint:all'
|
||||
options.encoding = 'UTF-8'
|
||||
}
|
||||
|
||||
task javadocJar(type: Jar) {
|
||||
dependsOn javadoc
|
||||
classifier 'javadoc'
|
||||
from javadoc.destinationDir
|
||||
}
|
||||
|
||||
artifacts {
|
||||
archives sourcesJar, javadocJar
|
||||
tasks.withType(Javadoc) {
|
||||
options.addStringOption('Xdoclint:none', '-quiet')
|
||||
options.encoding = 'UTF-8'
|
||||
}
|
16
gradle/publish/forgejo.gradle
Normal file
16
gradle/publish/forgejo.gradle
Normal file
|
@ -0,0 +1,16 @@
|
|||
if (project.hasProperty('forgeJoToken')) {
|
||||
publishing {
|
||||
repositories {
|
||||
maven {
|
||||
url 'https://xbib.org/api/packages/xbib/maven'
|
||||
credentials(HttpHeaderCredentials) {
|
||||
name = "Authorization"
|
||||
value = "token ${project.property('forgeJoToken')}"
|
||||
}
|
||||
authentication {
|
||||
header(HttpHeaderAuthentication)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
27
gradle/publish/ivy.gradle
Normal file
27
gradle/publish/ivy.gradle
Normal file
|
@ -0,0 +1,27 @@
|
|||
apply plugin: 'ivy-publish'
|
||||
|
||||
publishing {
|
||||
repositories {
|
||||
ivy {
|
||||
url = "https://xbib.org/repo"
|
||||
}
|
||||
}
|
||||
publications {
|
||||
ivy(IvyPublication) {
|
||||
from components.java
|
||||
descriptor {
|
||||
license {
|
||||
name = 'The Apache License, Version 2.0'
|
||||
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
|
||||
}
|
||||
author {
|
||||
name = 'Jörg Prante'
|
||||
url = 'http://example.com/users/jane'
|
||||
}
|
||||
descriptor.description {
|
||||
text = rootProject.ext.description
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,13 +1,10 @@
|
|||
|
||||
apply plugin: "de.marcphilipp.nexus-publish"
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
mavenJava(MavenPublication) {
|
||||
"${project.name}"(MavenPublication) {
|
||||
from components.java
|
||||
artifact sourcesJar
|
||||
artifact javadocJar
|
||||
pom {
|
||||
artifactId = project.name
|
||||
name = project.name
|
||||
description = rootProject.ext.description
|
||||
url = rootProject.ext.url
|
||||
|
@ -49,16 +46,6 @@ publishing {
|
|||
if (project.hasProperty("signing.keyId")) {
|
||||
apply plugin: 'signing'
|
||||
signing {
|
||||
sign publishing.publications.mavenJava
|
||||
}
|
||||
}
|
||||
|
||||
nexusPublishing {
|
||||
repositories {
|
||||
sonatype {
|
||||
username = project.property('ossrhUsername')
|
||||
password = project.property('ossrhPassword')
|
||||
packageGroup = "org.xbib"
|
||||
}
|
||||
sign publishing.publications."${project.name}"
|
||||
}
|
||||
}
|
11
gradle/publish/sonatype.gradle
Normal file
11
gradle/publish/sonatype.gradle
Normal file
|
@ -0,0 +1,11 @@
|
|||
if (project.hasProperty('ossrhUsername') && project.hasProperty('ossrhPassword')) {
|
||||
nexusPublishing {
|
||||
repositories {
|
||||
sonatype {
|
||||
username = project.property('ossrhUsername')
|
||||
password = project.property('ossrhPassword')
|
||||
packageGroup = "org.xbib"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
|
||||
if (project.hasProperty('ossrhUsername') && project.hasProperty('ossrhPassword')) {
|
||||
|
||||
apply plugin: 'io.codearte.nexus-staging'
|
||||
|
||||
nexusStaging {
|
||||
username = project.property('ossrhUsername')
|
||||
password = project.property('ossrhPassword')
|
||||
packageGroup = "org.xbib"
|
||||
}
|
||||
}
|
19
gradle/quality/checkstyle.gradle
Normal file
19
gradle/quality/checkstyle.gradle
Normal file
|
@ -0,0 +1,19 @@
|
|||
|
||||
apply plugin: 'checkstyle'
|
||||
|
||||
tasks.withType(Checkstyle) {
|
||||
ignoreFailures = true
|
||||
reports {
|
||||
xml.getRequired().set(true)
|
||||
html.getRequired().set(true)
|
||||
}
|
||||
}
|
||||
|
||||
checkstyle {
|
||||
configFile = rootProject.file('gradle/quality/checkstyle.xml')
|
||||
ignoreFailures = true
|
||||
showViolations = true
|
||||
checkstyleMain {
|
||||
source = sourceSets.main.allSource
|
||||
}
|
||||
}
|
|
@ -9,6 +9,10 @@ page at http://checkstyle.sourceforge.net/config.html -->
|
|||
|
||||
<module name="Checker">
|
||||
|
||||
<module name="BeforeExecutionExclusionFileFilter">
|
||||
<property name="fileNamePattern" value=".*(Example|Test|module-info)(\$.*)?"/>
|
||||
</module>
|
||||
|
||||
<module name="FileTabCharacter">
|
||||
<!-- Checks that there are no tab characters in the file.
|
||||
-->
|
||||
|
@ -56,10 +60,19 @@ page at http://checkstyle.sourceforge.net/config.html -->
|
|||
<!-- Checks for out of order import statements. -->
|
||||
|
||||
<property name="severity" value="warning"/>
|
||||
<property name="groups" value="com,junit,net,org,java,javax"/>
|
||||
<!-- This ensures that static imports go first. -->
|
||||
<property name="option" value="top"/>
|
||||
<property name="tokens" value="STATIC_IMPORT, IMPORT"/>
|
||||
<!-- <property name="tokens" value="IMPORT, STATIC_IMPORT"/> -->
|
||||
<property name="separated" value="false"/>
|
||||
<property name="groups" value="*"/>
|
||||
<!-- <property name="option" value="above"/> -->
|
||||
<property name="sortStaticImportsAlphabetically" value="true"/>
|
||||
</module>
|
||||
|
||||
<module name="CustomImportOrder">
|
||||
<!-- <property name="customImportOrderRules" value="THIRD_PARTY_PACKAGE###SPECIAL_IMPORTS###STANDARD_JAVA_PACKAGE###STATIC"/> -->
|
||||
<!-- <property name="specialImportsRegExp" value="^javax\."/> -->
|
||||
<!-- <property name="standardPackageRegExp" value="^java\."/> -->
|
||||
<property name="sortImportsInGroupAlphabetically" value="true"/>
|
||||
<property name="separateLineBetweenGroups" value="false"/>
|
||||
</module>
|
||||
|
||||
<!--
|
||||
|
@ -71,14 +84,10 @@ page at http://checkstyle.sourceforge.net/config.html -->
|
|||
<!-- Checks for Javadoc comments. -->
|
||||
<!-- See http://checkstyle.sf.net/config_javadoc.html -->
|
||||
<module name="JavadocMethod">
|
||||
<property name="scope" value="protected"/>
|
||||
<property name="accessModifiers" value="protected"/>
|
||||
<property name="severity" value="warning"/>
|
||||
<property name="allowMissingJavadoc" value="true"/>
|
||||
<property name="allowMissingParamTags" value="true"/>
|
||||
<property name="allowMissingReturnTag" value="true"/>
|
||||
<property name="allowMissingThrowsTags" value="true"/>
|
||||
<property name="allowThrowsTagsForSubclasses" value="true"/>
|
||||
<property name="allowUndeclaredRTE" value="true"/>
|
||||
</module>
|
||||
|
||||
<module name="JavadocType">
|
||||
|
@ -184,21 +193,6 @@ page at http://checkstyle.sourceforge.net/config.html -->
|
|||
|
||||
-->
|
||||
|
||||
<module name="LineLength">
|
||||
<!-- Checks if a line is too long. -->
|
||||
<property name="max" value="${com.puppycrawl.tools.checkstyle.checks.sizes.LineLength.max}" default="128"/>
|
||||
<property name="severity" value="error"/>
|
||||
|
||||
<!--
|
||||
The default ignore pattern exempts the following elements:
|
||||
- import statements
|
||||
- long URLs inside comments
|
||||
-->
|
||||
|
||||
<property name="ignorePattern"
|
||||
value="${com.puppycrawl.tools.checkstyle.checks.sizes.LineLength.ignorePattern}"
|
||||
default="^(package .*;\s*)|(import .*;\s*)|( *(\*|//).*https?://.*)$"/>
|
||||
</module>
|
||||
|
||||
<module name="LeftCurly">
|
||||
<!-- Checks for placement of the left curly brace ('{'). -->
|
||||
|
@ -319,5 +313,21 @@ page at http://checkstyle.sourceforge.net/config.html -->
|
|||
</module>
|
||||
|
||||
</module>
|
||||
|
||||
<module name="LineLength">
|
||||
<!-- Checks if a line is too long. -->
|
||||
<property name="max" value="${com.puppycrawl.tools.checkstyle.checks.sizes.LineLength.max}" default="128"/>
|
||||
<property name="severity" value="error"/>
|
||||
|
||||
<!--
|
||||
The default ignore pattern exempts the following elements:
|
||||
- import statements
|
||||
- long URLs inside comments
|
||||
-->
|
||||
|
||||
<property name="ignorePattern"
|
||||
value="${com.puppycrawl.tools.checkstyle.checks.sizes.LineLength.ignorePattern}"
|
||||
default="^(package .*;\s*)|(import .*;\s*)|( *(\*|//).*https?://.*)$"/>
|
||||
</module>
|
||||
</module>
|
||||
|
11
gradle/quality/cyclonedx.gradle
Normal file
11
gradle/quality/cyclonedx.gradle
Normal file
|
@ -0,0 +1,11 @@
|
|||
cyclonedxBom {
|
||||
includeConfigs = [ 'runtimeClasspath' ]
|
||||
skipConfigs = [ 'compileClasspath', 'testCompileClasspath' ]
|
||||
projectType = "library"
|
||||
schemaVersion = "1.4"
|
||||
destination = file("build/reports")
|
||||
outputName = "bom"
|
||||
outputFormat = "json"
|
||||
includeBomSerialNumber = true
|
||||
componentVersion = "2.0.0"
|
||||
}
|
17
gradle/quality/pmd.gradle
Normal file
17
gradle/quality/pmd.gradle
Normal file
|
@ -0,0 +1,17 @@
|
|||
|
||||
apply plugin: 'pmd'
|
||||
|
||||
tasks.withType(Pmd) {
|
||||
ignoreFailures = true
|
||||
reports {
|
||||
xml.getRequired().set(true)
|
||||
html.getRequired().set(true)
|
||||
}
|
||||
}
|
||||
|
||||
pmd {
|
||||
ignoreFailures = true
|
||||
consoleOutput = false
|
||||
toolVersion = "6.51.0"
|
||||
ruleSetFiles = rootProject.files('gradle/quality/pmd/category/java/bestpractices.xml')
|
||||
}
|
|
@ -48,6 +48,7 @@ public abstract class Foo {
|
|||
</rule>
|
||||
|
||||
<rule name="AccessorClassGeneration"
|
||||
language="java"
|
||||
since="1.04"
|
||||
maximumLanguageVersion="10"
|
||||
message="Avoid instantiation through private constructors from outside of the constructor's class."
|
||||
|
@ -109,6 +110,7 @@ public class OuterClass {
|
|||
</rule>
|
||||
|
||||
<rule name="ArrayIsStoredDirectly"
|
||||
language="java"
|
||||
since="2.2"
|
||||
message="The user-supplied array ''{0}'' is stored directly."
|
||||
class="net.sourceforge.pmd.lang.java.rule.bestpractices.ArrayIsStoredDirectlyRule"
|
||||
|
@ -168,6 +170,7 @@ class Foo {
|
|||
</rule>
|
||||
|
||||
<rule name="AvoidReassigningLoopVariables"
|
||||
language="java"
|
||||
since="6.11.0"
|
||||
message="Avoid reassigning the loop control variable ''{0}''"
|
||||
class="net.sourceforge.pmd.lang.java.rule.bestpractices.AvoidReassigningLoopVariablesRule"
|
||||
|
@ -216,6 +219,7 @@ public class Foo {
|
|||
</rule>
|
||||
|
||||
<rule name="AvoidReassigningParameters"
|
||||
language="java"
|
||||
since="1.0"
|
||||
message="Avoid reassigning parameters such as ''{0}''"
|
||||
class="net.sourceforge.pmd.lang.java.rule.bestpractices.AvoidReassigningParametersRule"
|
||||
|
@ -265,6 +269,7 @@ public class Foo {
|
|||
</rule>
|
||||
|
||||
<rule name="AvoidUsingHardCodedIP"
|
||||
language="java"
|
||||
since="4.1"
|
||||
message="Do not hard code the IP address ${variableName}"
|
||||
class="net.sourceforge.pmd.lang.java.rule.bestpractices.AvoidUsingHardCodedIPRule"
|
||||
|
@ -493,7 +498,7 @@ for (int i = 0, j = 0; i < 10; i++, j += 2) {
|
|||
<property name="xpath">
|
||||
<value>
|
||||
<![CDATA[
|
||||
//ClassOrInterfaceBodyDeclaration[MethodDeclaration/MethodDeclarator[@Image='suite']]
|
||||
//ClassOrInterfaceBodyDeclaration[MethodDeclaration/MethodDeclarator[@Name='suite']]
|
||||
[MethodDeclaration/ResultType/Type/ReferenceType/ClassOrInterfaceType[pmd-java:typeIs('junit.framework.Test')]]
|
||||
[not(MethodDeclaration/Block//ClassOrInterfaceType[pmd-java:typeIs('junit.framework.JUnit4TestAdapter')])]
|
||||
]]>
|
||||
|
@ -535,7 +540,7 @@ public class GoodTest {
|
|||
<value>
|
||||
<![CDATA[
|
||||
//ClassOrInterfaceBodyDeclaration
|
||||
[MethodDeclaration/MethodDeclarator[@Image='tearDown']]
|
||||
[MethodDeclaration/MethodDeclarator[@Name='tearDown']]
|
||||
[count(Annotation//Name[
|
||||
pmd-java:typeIs('org.junit.After')
|
||||
or pmd-java:typeIs('org.junit.jupiter.api.AfterEach')
|
||||
|
@ -579,7 +584,7 @@ public class MyTest2 {
|
|||
<value>
|
||||
<![CDATA[
|
||||
//ClassOrInterfaceBodyDeclaration
|
||||
[MethodDeclaration/MethodDeclarator[@Image='setUp']]
|
||||
[MethodDeclaration/MethodDeclarator[@Name='setUp']]
|
||||
[count(Annotation//Name[
|
||||
pmd-java:typeIs('org.junit.Before')
|
||||
or pmd-java:typeIs('org.junit.jupiter.api.BeforeEach')
|
||||
|
@ -623,10 +628,10 @@ public class MyTest2 {
|
|||
<value>
|
||||
<![CDATA[
|
||||
//ClassOrInterfaceDeclaration[
|
||||
matches(@Image, $testClassPattern)
|
||||
matches(@SimpleName, $testClassPattern)
|
||||
or ExtendsList/ClassOrInterfaceType[pmd-java:typeIs('junit.framework.TestCase')]]
|
||||
|
||||
/ClassOrInterfaceBody/ClassOrInterfaceBodyDeclaration[MethodDeclaration[@Public=true()]/MethodDeclarator[starts-with(@Image, 'test')]]
|
||||
/ClassOrInterfaceBody/ClassOrInterfaceBodyDeclaration[MethodDeclaration[@Public=true()]/MethodDeclarator[starts-with(@Name, 'test')]]
|
||||
[not(Annotation//Name[
|
||||
pmd-java:typeIs('org.junit.Test')
|
||||
or pmd-java:typeIs('org.junit.jupiter.api.Test') or pmd-java:typeIs('org.junit.jupiter.api.RepeatedTest')
|
||||
|
@ -656,6 +661,7 @@ public class MyTest {
|
|||
</rule>
|
||||
|
||||
<rule name="JUnitAssertionsShouldIncludeMessage"
|
||||
language="java"
|
||||
since="1.04"
|
||||
message="JUnit assertions should include a message"
|
||||
class="net.sourceforge.pmd.lang.java.rule.bestpractices.JUnitAssertionsShouldIncludeMessageRule"
|
||||
|
@ -734,6 +740,7 @@ public class MyTestCase extends TestCase {
|
|||
</rule>
|
||||
|
||||
<rule name="JUnitTestsShouldIncludeAssert"
|
||||
language="java"
|
||||
since="2.0"
|
||||
message="JUnit tests should include assert() or fail()"
|
||||
class="net.sourceforge.pmd.lang.java.rule.bestpractices.JUnitTestsShouldIncludeAssertRule"
|
||||
|
@ -758,6 +765,7 @@ public class Foo extends TestCase {
|
|||
</rule>
|
||||
|
||||
<rule name="JUnitUseExpected"
|
||||
language="java"
|
||||
since="4.0"
|
||||
message="In JUnit4, use the @Test(expected) annotation to denote tests that should throw exceptions"
|
||||
class="net.sourceforge.pmd.lang.java.rule.bestpractices.JUnitUseExpectedRule"
|
||||
|
@ -788,6 +796,7 @@ public class MyTest {
|
|||
</rule>
|
||||
|
||||
<rule name="LooseCoupling"
|
||||
language="java"
|
||||
since="0.7"
|
||||
message="Avoid using implementation types like ''{0}''; use the interface instead"
|
||||
class="net.sourceforge.pmd.lang.java.rule.bestpractices.LooseCouplingRule"
|
||||
|
@ -824,6 +833,7 @@ public class Bar {
|
|||
</rule>
|
||||
|
||||
<rule name="MethodReturnsInternalArray"
|
||||
language="java"
|
||||
since="2.2"
|
||||
message="Returning ''{0}'' may expose an internal array."
|
||||
class="net.sourceforge.pmd.lang.java.rule.bestpractices.MethodReturnsInternalArrayRule"
|
||||
|
@ -848,6 +858,7 @@ public class SecureSystem {
|
|||
|
||||
|
||||
<rule name="MissingOverride"
|
||||
language="java"
|
||||
since="6.2.0"
|
||||
minimumLanguageVersion="1.5"
|
||||
message="The method ''{0}'' is missing an @Override annotation."
|
||||
|
@ -1000,6 +1011,7 @@ class Foo {
|
|||
</rule>
|
||||
|
||||
<rule name="PreserveStackTrace"
|
||||
language="java"
|
||||
since="3.7"
|
||||
message="New exception is thrown in catch block, original stack trace may be lost"
|
||||
class="net.sourceforge.pmd.lang.java.rule.bestpractices.PreserveStackTraceRule"
|
||||
|
@ -1217,6 +1229,7 @@ public class Foo {
|
|||
</rule>
|
||||
|
||||
<rule name="UnusedImports"
|
||||
language="java"
|
||||
since="1.0"
|
||||
message="Avoid unused imports such as ''{0}''"
|
||||
class="net.sourceforge.pmd.lang.java.rule.bestpractices.UnusedImportsRule"
|
||||
|
@ -1489,6 +1502,7 @@ public class MyTestCase extends TestCase {
|
|||
</rule>
|
||||
|
||||
<rule name="UseCollectionIsEmpty"
|
||||
language="java"
|
||||
since="3.9"
|
||||
message="Substitute calls to size() == 0 (or size() != 0, size() > 0, size() < 1) with calls to isEmpty()"
|
||||
class="net.sourceforge.pmd.lang.java.rule.bestpractices.UseCollectionIsEmptyRule"
|
||||
|
@ -1546,7 +1560,7 @@ public class Foo {
|
|||
][
|
||||
pmd-java:typeIs('java.lang.AutoCloseable')
|
||||
or
|
||||
../../PrimarySuffix/Arguments[@ArgumentCount = 1]//PrimaryPrefix[pmd-java:typeIs('java.lang.AutoCloseable')]
|
||||
../../PrimarySuffix/Arguments[@Size = 1]//PrimaryPrefix[pmd-java:typeIs('java.lang.AutoCloseable')]
|
||||
]]
|
||||
]]>
|
||||
</value>
|
|
@ -1,6 +1,3 @@
|
|||
#
|
||||
# BSD-style license; for more info see http://pmd.sourceforge.net/license.html
|
||||
#
|
||||
|
||||
rulesets.filenames=\
|
||||
category/java/bestpractices.xml,\
|
|
@ -760,7 +760,7 @@ public class HelloWorldBean {
|
|||
<![CDATA[
|
||||
public class Foo {
|
||||
void bar() {
|
||||
for (;true;) true; // No Init or Update part, may as well be: while (true)
|
||||
for (;true;) true; // No Init or Update message, may as well be: while (true)
|
||||
}
|
||||
}
|
||||
]]>
|
|
@ -158,7 +158,7 @@ public class A {
|
|||
message="Avoid using a branching statement as the last in a loop."
|
||||
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_errorprone.html#avoidbranchingstatementaslastinloop">
|
||||
<description>
|
||||
Using a branching statement as the last part of a loop may be a bug, and/or is confusing.
|
||||
Using a branching statement as the last message of a loop may be a bug, and/or is confusing.
|
||||
Ensure that the usage is not a bug, or consider using another approach.
|
||||
</description>
|
||||
<priority>2</priority>
|
||||
|
@ -1554,7 +1554,7 @@ public class Foo {
|
|||
<rule name="EmptyStatementNotInLoop"
|
||||
language="java"
|
||||
since="1.5"
|
||||
message="An empty statement (semicolon) not part of a loop"
|
||||
message="An empty statement (semicolon) not message of a loop"
|
||||
class="net.sourceforge.pmd.lang.rule.XPathRule"
|
||||
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_errorprone.html#emptystatementnotinloop">
|
||||
<description>
|
37
gradle/quality/sonarqube.gradle
Normal file
37
gradle/quality/sonarqube.gradle
Normal file
|
@ -0,0 +1,37 @@
|
|||
|
||||
subprojects {
|
||||
|
||||
sonarqube {
|
||||
properties {
|
||||
property "sonar.projectName", "${project.group} ${project.name}"
|
||||
property "sonar.sourceEncoding", "UTF-8"
|
||||
property "sonar.tests", "src/test/java"
|
||||
property "sonar.scm.provider", "git"
|
||||
property "sonar.junit.reportsPath", "build/test-results/test/"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
tasks.withType(Pmd) {
|
||||
ignoreFailures = true
|
||||
reports {
|
||||
xml.enabled = true
|
||||
html.enabled = true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
spotbugs {
|
||||
effort = "max"
|
||||
reportLevel = "low"
|
||||
//includeFilter = file("findbugs-exclude.xml")
|
||||
}
|
||||
|
||||
tasks.withType(com.github.spotbugs.SpotBugsTask) {
|
||||
ignoreFailures = true
|
||||
reports {
|
||||
xml.enabled = false
|
||||
html.enabled = true
|
||||
}
|
||||
}
|
||||
}
|
15
gradle/quality/spotbugs.gradle
Normal file
15
gradle/quality/spotbugs.gradle
Normal file
|
@ -0,0 +1,15 @@
|
|||
|
||||
apply plugin: 'com.github.spotbugs'
|
||||
|
||||
spotbugs {
|
||||
effort = "max"
|
||||
reportLevel = "low"
|
||||
ignoreFailures = true
|
||||
}
|
||||
|
||||
spotbugsMain {
|
||||
reports {
|
||||
xml.getRequired().set(false)
|
||||
html.getRequired().set(true)
|
||||
}
|
||||
}
|
4
gradle/repositories/maven.gradle
Normal file
4
gradle/repositories/maven.gradle
Normal file
|
@ -0,0 +1,4 @@
|
|||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
}
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
3
gradle/wrapper/gradle-wrapper.properties
vendored
3
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,5 +1,6 @@
|
|||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-all.zip
|
||||
networkTimeout=10000
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
|
19
gradlew
vendored
19
gradlew
vendored
|
@ -55,7 +55,7 @@
|
|||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
|
@ -80,13 +80,10 @@ do
|
|||
esac
|
||||
done
|
||||
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
APP_NAME="Gradle"
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
|
@ -143,12 +140,16 @@ fi
|
|||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
|
@ -193,6 +194,10 @@ if "$cygwin" || "$msys" ; then
|
|||
done
|
||||
fi
|
||||
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command;
|
||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||
# shell script including quotes and variable substitutions, so put them in
|
||||
|
|
1
gradlew.bat
vendored
1
gradlew.bat
vendored
|
@ -26,6 +26,7 @@ if "%OS%"=="Windows_NT" setlocal
|
|||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@rem This is normally unused
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
|
|
|
@ -16,12 +16,12 @@ import java.util.EnumSet;
|
|||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@Disabled("takes long time")
|
||||
class BundeskunsthalleTest {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(BundeskunsthalleTest.class.getName());
|
||||
|
||||
@Test
|
||||
@Disabled("takes long time")
|
||||
void testListRecords() throws Exception {
|
||||
OAIClient oaiClient = new OAIClient("https://www.bundeskunsthalle.de/cgi-bin/bib/oai-pmh");
|
||||
IdentifyResponse identifyResponse = oaiClient.identify();
|
||||
|
@ -29,8 +29,8 @@ class BundeskunsthalleTest {
|
|||
logger.log(Level.INFO, "granularity = " + granularity);
|
||||
DateTimeFormatter dateTimeFormatter = "YYYY-MM-DD".equals(granularity) ?
|
||||
DateTimeFormatter.ofPattern("yyyy-MM-dd").withZone(ZoneId.of("UTC")) : null;
|
||||
try (MarcJsonWriter writer = new MarcJsonWriter("build/bk-bulk%d.jsonl", 1000,
|
||||
EnumSet.of(MarcJsonWriter.Style.ELASTICSEARCH_BULK), 8192, false)
|
||||
try (MarcJsonWriter writer = new MarcJsonWriter("build/bk-bulk%d.jsonl", 1000, 8192, false)
|
||||
.setStyle(EnumSet.of(MarcJsonWriter.Style.ELASTICSEARCH_BULK))
|
||||
.setIndex("bk", "type")) {
|
||||
writer.startDocument();
|
||||
writer.beginCollection();
|
||||
|
|
|
@ -1,21 +1,13 @@
|
|||
package org.xbib.oai.client;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.xbib.oai.client.identify.IdentifyResponse;
|
||||
import org.xbib.oai.xml.SimpleMetadataHandler;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@Disabled("port is locked")
|
||||
class DNBClientTest {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(DNBClientTest.class.getName());
|
||||
|
||||
@Test
|
||||
void testBibdatFileDump() throws Exception {
|
||||
OAIClient oaiClient = new OAIClient("http://services.dnb.de/oai/repository");
|
||||
|
@ -35,39 +27,12 @@ class DNBClientTest {
|
|||
oaiClient.setUserAgent("Hochschulbibliothekszentrum Nordrhein-Westfalen (prante@hbz-nrw.de)");
|
||||
Instant base = Instant.parse("2010-01-01T00:00:00Z");
|
||||
|
||||
//IdentifyResponse identifyResponse = oaiClient.identify();
|
||||
//String granularity = identifyResponse.getGranularity();
|
||||
//logger.log(Level.INFO, "granularity = " + granularity);
|
||||
//DateTimeFormatter dateTimeFormatter = "YYYY-MM-DD".equals(granularity) ?
|
||||
// DateTimeFormatter.ofPattern("yyyy-MM-dd").withZone(ZoneId.of("UTC")) : null;
|
||||
SplitWriter splitWriter = new SplitWriter("build/bibdat-test-%d.xml", -1, 8192, false);
|
||||
oaiClient.setSplitWriter(splitWriter);
|
||||
// Handler handler = new Handler();
|
||||
oaiClient.listRecords("PicaPlus-xml", "bib", null,
|
||||
Instant.parse("2016-01-01T00:00:00Z"),
|
||||
Instant.parse("2016-02-01T00:00:00Z"),
|
||||
base, null, null);
|
||||
//logger.log(Level.INFO, "count=" + handler.count());
|
||||
//assertTrue(handler.count() > 0);
|
||||
}
|
||||
|
||||
static class Handler extends SimpleMetadataHandler {
|
||||
|
||||
final AtomicLong count = new AtomicLong(0L);
|
||||
|
||||
@Override
|
||||
public void startDocument() {
|
||||
logger.log(Level.INFO, "start doc");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endDocument() {
|
||||
logger.log(Level.INFO, "end doc");
|
||||
count.incrementAndGet();
|
||||
}
|
||||
|
||||
long count() {
|
||||
return count.get();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
dependencyResolutionManagement {
|
||||
versionCatalogs {
|
||||
libs {
|
||||
version('gradle', '7.5.1')
|
||||
version('junit', '5.9.1')
|
||||
version('content', '5.0.1')
|
||||
version('gradle', '8.1.1')
|
||||
version('junit', '5.9.3')
|
||||
version('content', '5.0.3')
|
||||
library('junit-jupiter-api', 'org.junit.jupiter', 'junit-jupiter-api').versionRef('junit')
|
||||
library('junit-jupiter-params', 'org.junit.jupiter', 'junit-jupiter-params').versionRef('junit')
|
||||
library('junit-jupiter-engine', 'org.junit.jupiter', 'junit-jupiter-engine').versionRef('junit')
|
||||
|
@ -12,8 +12,8 @@ dependencyResolutionManagement {
|
|||
library('content-rdf', 'org.xbib', 'content-rdf').versionRef('content')
|
||||
library('content-resource', 'org.xbib', 'content-resource').versionRef('content')
|
||||
library('content-xml', 'org.xbib', 'content-xml').versionRef('content')
|
||||
library('marc', 'org.xbib', 'marc').version('2.7.1')
|
||||
library('charactersets', 'org.xbib', 'bibliographic-character-sets').version('2.0.0')
|
||||
library('marc', 'org.xbib', 'marc').version('2.11.0')
|
||||
library('charactersets', 'org.xbib', 'bibliographic-character-sets').version('3.0.0')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue