Skip to content

Commit d0e1c12

Browse files
committed
Get publishing to gradle working with gradle-nexus/publish-plugin
1 parent ce0ccbc commit d0e1c12

File tree

4 files changed

+27
-21
lines changed

4 files changed

+27
-21
lines changed

RSyntaxTextArea/build.gradle

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,6 @@ test {
5050
}
5151

5252
publishing {
53-
repositories {
54-
maven {
55-
def releasesRepoUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2/'
56-
def snapshotsRepoUrl = 'https://oss.sonatype.org/content/repositories/snapshots/'
57-
url = isReleaseVersion ? releasesRepoUrl : snapshotsRepoUrl
58-
credentials { // Credentials usually kept in user's .gradle/gradle.properties
59-
// We must defensively check for these properties so CI builds work
60-
username = project.hasProperty('ossrhToken') ? ossrhToken : 'unknown'
61-
password = project.hasProperty('ossrhTokenPassword') ? ossrhTokenPassword : 'unknown'
62-
}
63-
}
64-
}
6553
publications {
6654
maven(MavenPublication) {
6755

RSyntaxTextArea/src/main/java/org/fife/ui/rsyntaxtextarea/Theme.java

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,7 @@
2121

2222
import javax.swing.UIManager;
2323
import javax.swing.plaf.ColorUIResource;
24-
import javax.xml.parsers.DocumentBuilder;
25-
import javax.xml.parsers.DocumentBuilderFactory;
26-
import javax.xml.parsers.SAXParser;
27-
import javax.xml.parsers.SAXParserFactory;
24+
import javax.xml.parsers.*;
2825
import javax.xml.transform.OutputKeys;
2926
import javax.xml.transform.Transformer;
3027
import javax.xml.transform.TransformerFactory;
@@ -613,12 +610,12 @@ public static void load(Theme theme, InputStream in) throws IOException {
613610
SAXParserFactory spf = SAXParserFactory.newInstance();
614611
spf.setValidating(true);
615612

616-
// Disable external entity resolution to prevent XXE attacks
617-
spf.setFeature("http://xml.org/sax/features/external-general-entities", false);
618-
spf.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
619-
spf.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
620-
621613
try {
614+
// Disable external entity resolution to prevent XXE attacks
615+
spf.setFeature("http://xml.org/sax/features/external-general-entities", false);
616+
spf.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
617+
spf.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
618+
622619
SAXParser parser = spf.newSAXParser();
623620
XMLReader reader = parser.getXMLReader();
624621
XmlHandler handler = new XmlHandler();

build.gradle

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@ buildscript {
99

1010
plugins {
1111
id 'com.github.spotbugs' version '6.1.7'
12+
id 'io.github.gradle-nexus.publish-plugin' version '2.0.0'
1213
}
1314

15+
apply plugin: 'io.github.gradle-nexus.publish-plugin'
16+
1417
// We require building with JDK 17 or later. Built artifact compatibility
1518
// is controlled by javaLanguageVersion
1619
assert JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_17)
@@ -91,3 +94,15 @@ subprojects {
9194
options.compilerArgs << '-Xlint:deprecation' << '-Xlint:unchecked'
9295
}
9396
}
97+
98+
nexusPublishing {
99+
repositories {
100+
sonatype {
101+
nexusUrl.set(uri("https://ossrh-staging-api.central.sonatype.com/service/local/"))
102+
snapshotRepositoryUrl.set(uri("https://central.sonatype.com/repository/maven-snapshots/"))
103+
// We must defensively check for these properties so CI builds work
104+
username.set(project.hasProperty('sonatypeUsername') ? sonatypeUsername : 'unknown')
105+
password.set(project.hasProperty('sonatypePassword') ? sonatypePassword : 'unknown')
106+
}
107+
}
108+
}

settings.gradle

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
pluginManagement {
2+
repositories {
3+
gradlePluginPortal()
4+
}
5+
}
6+
17
rootProject.name = 'RSyntaxTextArea'
28

39
include 'RSyntaxTextArea', 'RSyntaxTextAreaDemo'

0 commit comments

Comments
 (0)