Skip to content

Commit ee0d0ba

Browse files
Update to 0.1.0 and upload to Sonatype
1 parent f8d5e31 commit ee0d0ba

File tree

4 files changed

+115
-13
lines changed

4 files changed

+115
-13
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# scala-suffix Maven Plugin
22

3-
A Maven plugin which fixes Scala jars incompatibility with Java 9+.
3+
A Maven plugin which fixes Scala dependencies incompatible with Java 9+.
44

55
### A bit of context
66

pom.xml

Lines changed: 104 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,136 @@
44
<groupId>io.github.makingthematrix</groupId>
55
<artifactId>scala-suffix-maven-plugin</artifactId>
66
<packaging>maven-plugin</packaging>
7-
<version>0.0.3</version>
7+
<version>0.1.0</version>
88
<name>Scala SufFix Maven Plugin</name>
99
<url>https://github.com/makingthematrix/scala-suffix</url>
1010
<organization>
1111
<name>makingthematrix</name>
1212
<url>https://github.com/makingthematrix</url>
1313
</organization>
1414

15+
<!-- -->
16+
<description>Fixes Scala dependencies incompatible with Java 9+.</description>
17+
18+
<scm>
19+
<connection>scm:git:https://github.com/makingthematrix/scala-suffix.git</connection>
20+
<developerConnection>scm:git:https://github.com/makingthematrix/scala-suffix.git</developerConnection>
21+
<url>https://github.com/github.com/makingthematrix/scala-suffix</url>
22+
<tag>scala-suffix</tag>
23+
</scm>
24+
25+
<issueManagement>
26+
<system>GitHub</system>
27+
<url>https://github.com/makingthematrix/scala-suffix/issues</url>
28+
</issueManagement>
29+
30+
<developers>
31+
<developer>
32+
<id>makingthematrix</id>
33+
<name>Maciej Gorywoda</name>
34+
<email>[email protected]</email>
35+
<url>https://github.com/makingthematrix</url>
36+
<organization>makingthematrix</organization>
37+
<organizationUrl>https://github.com/makingthematrix</organizationUrl>
38+
<roles>
39+
<role>developer</role>
40+
</roles>
41+
<timezone>Europe/Berlin</timezone>
42+
<properties>
43+
<picUrl>https://avatars.githubusercontent.com/u/4498008?v=4</picUrl>
44+
</properties>
45+
</developer>
46+
</developers>
47+
48+
<!-- -->
49+
1550
<properties>
1651
<maven-compiler-plugin-version>3.8.1</maven-compiler-plugin-version>
1752
<maven.compiler.source>11</maven.compiler.source>
1853
<maven.compiler.target>11</maven.compiler.target>
1954
</properties>
2055

56+
<distributionManagement>
57+
<snapshotRepository>
58+
<id>ossrh</id>
59+
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
60+
</snapshotRepository>
61+
</distributionManagement>
62+
63+
<licenses>
64+
<license>
65+
<name>Apache License, Version 2.0</name>
66+
<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
67+
<distribution>repo</distribution>
68+
<comments>A business-friendly OSS license</comments>
69+
</license>
70+
</licenses>
71+
2172
<build>
2273
<plugins>
74+
<plugin>
75+
<groupId>org.sonatype.plugins</groupId>
76+
<artifactId>nexus-staging-maven-plugin</artifactId>
77+
<version>1.6.7</version>
78+
<extensions>true</extensions>
79+
<configuration>
80+
<serverId>ossrh</serverId>
81+
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
82+
<autoReleaseAfterClose>true</autoReleaseAfterClose>
83+
</configuration>
84+
</plugin>
2385
<plugin>
2486
<groupId>org.apache.maven.plugins</groupId>
2587
<artifactId>maven-compiler-plugin</artifactId>
2688
<version>${maven-compiler-plugin-version}</version>
2789
</plugin>
90+
<plugin>
91+
<groupId>org.apache.maven.plugins</groupId>
92+
<artifactId>maven-source-plugin</artifactId>
93+
<version>3.2.1</version>
94+
<executions>
95+
<execution>
96+
<id>attach-sources</id>
97+
<goals>
98+
<goal>jar-no-fork</goal>
99+
</goals>
100+
</execution>
101+
</executions>
102+
</plugin>
103+
<plugin>
104+
<groupId>org.apache.maven.plugins</groupId>
105+
<artifactId>maven-javadoc-plugin</artifactId>
106+
<version>3.0.1</version>
107+
<executions>
108+
<execution>
109+
<id>attach-javadocs</id>
110+
<goals>
111+
<goal>jar</goal>
112+
</goals>
113+
</execution>
114+
</executions>
115+
</plugin>
28116
<plugin>
29117
<groupId>org.apache.maven.plugins</groupId>
30118
<artifactId>maven-plugin-plugin</artifactId>
31119
<version>3.6.1</version>
32120
</plugin>
121+
<plugin>
122+
<groupId>org.apache.maven.plugins</groupId>
123+
<artifactId>maven-gpg-plugin</artifactId>
124+
<version>1.5</version>
125+
<executions>
126+
<execution>
127+
<id>sign-artifacts</id>
128+
<phase>verify</phase>
129+
<goals>
130+
<goal>sign</goal>
131+
</goals>
132+
</execution>
133+
</executions>
134+
</plugin>
33135
</plugins>
136+
34137
<defaultGoal>suffix</defaultGoal>
35138
</build>
36139

src/main/java/io/github/makingthematrix/ManifestToFix.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@ public ManifestToFix(@NotNull final File artifactFile, @NotNull final File outpu
3333
this.manifestFile = new File(outputDir, MANIFEST_MF);
3434
}
3535

36-
public boolean fixLib(@NotNull String newLibraryName) throws IOException {
36+
public boolean fixLib(@NotNull String libraryName) throws IOException {
3737
if (manifestFile.exists()) {
38-
return fixManifestFile(newLibraryName);
38+
return fixManifestFile(libraryName);
3939
} else {
4040
throw new IOException("No file " + manifestFile.getAbsolutePath() + " found");
4141
}
4242
}
4343

44-
private boolean fixManifestFile(String newLibraryName) throws IOException {
44+
private boolean fixManifestFile(String libraryName) throws IOException {
4545
final var manifestLines = FileUtils.readLines(manifestFile, Charset.defaultCharset());
4646
final var moduleNameLine =
4747
manifestLines.stream()
@@ -52,20 +52,20 @@ private boolean fixManifestFile(String newLibraryName) throws IOException {
5252
return false;
5353
}
5454

55-
addAutomaticModuleName(manifestLines, newLibraryName);
55+
addAutomaticModuleName(manifestLines, libraryName);
5656
if (!zipFile.isValidZipFile()) {
5757
throw new IOException("After the operation the zip file is INVALID: " + zipFile.getFile().getAbsolutePath());
5858
}
5959
return true;
6060
}
6161

62-
private void addAutomaticModuleName(List<String> manifestLines, String newLibraryName) throws IOException {
62+
private void addAutomaticModuleName(List<String> manifestLines, String libraryName) throws IOException {
6363
final var newManifestLines =
6464
List.copyOf(manifestLines).stream()
6565
.map(String::trim)
6666
.filter(line -> !line.isBlank())
6767
.collect(Collectors.toList());
68-
newManifestLines.add(AUTOMATIC_MODULE_NAME + ": " + newLibraryName);
68+
newManifestLines.add(AUTOMATIC_MODULE_NAME + ": " + libraryName);
6969

7070
manifestFile.createNewFile();
7171
FileUtils.writeLines(manifestFile, newManifestLines);

src/main/java/io/github/makingthematrix/SufFixMojo.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,12 @@ public final class SufFixMojo extends AbstractMojo {
5757

5858
public void execute() {
5959
final var artifacts = (Set<Artifact>)Collections.unmodifiableSet(project.getDependencyArtifacts());
60-
libraries.stream().map(newLibraryName ->
60+
libraries.stream().map(libraryName ->
6161
artifacts.stream()
62-
.filter(art -> art.getArtifactId().toLowerCase().contains(newLibraryName))
62+
.filter(art -> art.getArtifactId().toLowerCase().contains(libraryName))
6363
.findAny()
64-
.map(art -> Tuple.of(art.getFile(), newLibraryName))
65-
).filter(Optional::isPresent)
66-
.map(Optional::get)
64+
.map(art -> Tuple.of(art.getFile(), libraryName))
65+
).flatMap(Optional::stream)
6766
.forEach(this::fixManifest);
6867
}
6968

0 commit comments

Comments
 (0)