Skip to content

Commit

Permalink
fix SLF4J-456
Browse files Browse the repository at this point in the history
  • Loading branch information
ceki committed Feb 19, 2019
1 parent e9d4b6a commit fb418db
Show file tree
Hide file tree
Showing 18 changed files with 177 additions and 42 deletions.
6 changes: 5 additions & 1 deletion jcl-over-slf4j/pom.xml
Expand Up @@ -16,6 +16,10 @@
<description>JCL 1.2 implemented over SLF4J</description>
<url>http://www.slf4j.org</url>

<properties>
<module-name>org.apache.commons.logging</module-name>

This comment has been minimized.

Copy link
@cowwoc

cowwoc Feb 19, 2019

Uh... Why? This module is not apache commons. I must be missing something right?

This comment has been minimized.

Copy link
@ceki

ceki Feb 19, 2019

Author Member

it's a full replacement for org.apache.commons.logging. So yes it is commons-logging if the user chooses to place it on his/her classpath.

</properties>

<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
Expand All @@ -28,4 +32,4 @@
</dependency>
</dependencies>

</project>
</project>
2 changes: 1 addition & 1 deletion jul-to-slf4j/src/main/resources/META-INF/MANIFEST.MF
Expand Up @@ -5,4 +5,4 @@ Bundle-Vendor: SLF4J.ORG
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Export-Package: org.slf4j.bridge;version=${parsedVersion.osgiVersion};uses:="org.slf4j,org.slf4j.spi"
Import-Package: org.slf4j;version=${parsedVersion.osgiVersion},org.slf4j.spi;version=${parsedVersion.osgiVersion}
Automatic-Module-Name: jul_to_slf4j
Automatic-Module-Name: jul.to.slf4j
6 changes: 5 additions & 1 deletion log4j-over-slf4j/pom.xml
Expand Up @@ -25,6 +25,10 @@
</license>
</licenses>

<properties>
<module-name>log4j</module-name>
</properties>

<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
Expand All @@ -37,4 +41,4 @@
</dependency>
</dependencies>

</project>
</project>
55 changes: 40 additions & 15 deletions pom.xml
Expand Up @@ -33,7 +33,7 @@
</scm>

<properties>
<stable.version>1.7.25</stable.version>
<latest.stable.version>1.7.26</latest.stable.version>
<!-- java.util.ServiceLoader requires Java 6 -->
<jdk.version>1.6</jdk.version>
<maven.compiler.source>${jdk.version}</maven.compiler.source>
Expand All @@ -50,6 +50,7 @@
<maven-site-plugin.version>3.6</maven-site-plugin.version>
<compiler-plugin.version>3.6.1</compiler-plugin.version>

This comment has been minimized.

Copy link
@cowwoc

cowwoc Feb 19, 2019

The compiler version needs to be 3.8.0 or higher for Java 9+ support.

This comment has been minimized.

Copy link
@ceki

ceki Feb 19, 2019

Author Member

As far as I can tell, it compiles just fine with 3.6.1. What am I missing?

This comment has been minimized.

Copy link
@cowwoc

cowwoc Feb 19, 2019

Sorry, I think 3.8.0+ is only needed when the target bytecode is Java 11 and higher. I'm guessing this means you're not affected.

<javadoc.plugin.version>2.10.4</javadoc.plugin.version>
<maven-source-plugin.version>3.0.1</maven-source-plugin.version>
</properties>

<developers>
Expand Down Expand Up @@ -183,34 +184,45 @@
<executions>

<execution>
<id>base-compile</id>
<id>default-compile</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<excludes>
<exclude>module-info.java</exclude>
</excludes>
<jdkToolchain>
<version>[6, )</version>
</jdkToolchain>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
</configuration>
</execution>

<execution>
<id>default-compile</id>
<execution>
<id>module-compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<jdkToolchain>
<version>[9, )</version>
</jdkToolchain>
<release>9</release>
<compileSourceRoots>
<compileSourceRoot>${project.basedir}/src/main/java9</compileSourceRoot>
</compileSourceRoots>
<outputDirectory>${project.build.outputDirectory}/META-INF/versions/9</outputDirectory>

This comment has been minimized.

Copy link
@joakime

joakime Mar 5, 2020

This triggers build warnings on javac.

The module-info.class shouldn't be in the META-INF/versions/9 in the jar file, it should be in the root of the jar file.
Yes, I'm aware of SLF4J-456, but that's a bug in websphere's annotation parsing (a similar bug that all web containers have had to fix).

From maven (Jetty 10.x is migrating to Slf4j 2.0.0-alpha1 btw).

[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ jetty-slf4j-impl ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 9 source files to /home/joakim/code/jetty/jetty.project-10.0.x/jetty-slf4j-impl/target/classes
[WARNING] /home/joakim/code/jetty/jetty.project-10.0.x/jetty-slf4j-impl/src/main/java/module-info.java:[26,28] requires transitive directive for an automatic module

The warning is because the module-info.class is not present at the root of the jar file (where it must be, despite the jigsaw devs brief suggestion in 2018 that META-INF/versions/9 could be a solution, the other tooling hasn't caught up yet, even in JDK 14!, even including javac).

javac sees slf4j-api-2.0.0-alpha1.jar as having no module-info.class and is instead using the jar as one with an automatic module name.

Repackaging slf4j-api-2.0.0-alpha1.jar with the module-info.class in the root fixes the javac warnings.

This comment has been minimized.

Copy link
@cowwoc

cowwoc Mar 5, 2020

@joakime I suggest filing a separate bug report. I'm not sure whether @ceki will notice this comment.

<compilerArgs>
<arg>--patch-module</arg>
<arg>${module-name}=${project.build.outputDirectory}</arg>
</compilerArgs>
</configuration>
</execution>



</executions>
<configuration>
<jdkToolchain>
<version>[1.6, )</version>
</jdkToolchain>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
</configuration>

</plugin>

<plugin>
Expand All @@ -225,6 +237,7 @@
<X-Compile-Source-JDK>${maven.compiler.source}</X-Compile-Source-JDK>
<X-Compile-Target-JDK>${maven.compiler.target}</X-Compile-Target-JDK>
<Implementation-Version>${project.version}</Implementation-Version>
<Multi-Release>true</Multi-Release>
</manifestEntries>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
</archive>
Expand All @@ -251,7 +264,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.1.2</version>
<version>${maven-source-plugin.version}</version>
<executions>
<execution>
<phase>package</phase>
Expand Down Expand Up @@ -492,6 +505,18 @@
</profiles>

<pluginRepositories>
<pluginRepository>
<id>apache-snapshot-repo</id>
<name>apache-snapshot-repo</name>
<url>https://repository.apache.org/content/groups/snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>

</pluginRepository>
</pluginRepositories>

<distributionManagement>
Expand Down
49 changes: 49 additions & 0 deletions release.sh
@@ -0,0 +1,49 @@
#mvn versions:set -DgenerateBackupPoms=false -DnewVersion=${VERSION_NUMBER}

MVN='/java/maven-3.5.2//bin/mvn'

PASS=$1
echo $PASS

function checkExit(){
if test "$?" != "0"; then
echo Command $1 exited with abnormal status
exit 1;
else echo $?
fi
}

function echoThenRun () { # echo and then run the command
echo $1
$1
ret=$?
echo $ret
return $ret
}

$MVN clean
checkExit "mvn clean"


$MVN install
checkExit "mvn install"


$MVN site:site
checkExit "mvn site:ste"


$MVN assembly:single
checkExit "mvn assembly:single"


$MVN deploy -P javadocjar,sign-artifacts -Dgpg.passphrase=$PASS
checkExit "mvn deploy -P javadocjar,sign-artifacts -Dgpg.passphrase=xxx"

#$MVN site:deploy -N # with Java 8!!!
#checkExit "mvn site:deploy -N"

#git tag -m "tagging" -a v_${VERSION_NUMBER}
#git push --tags

#release version and add next version on jira
6 changes: 5 additions & 1 deletion slf4j-api/pom.xml
Expand Up @@ -18,6 +18,10 @@

<url>http://www.slf4j.org</url>

<properties>
<module-name>org.slf4j</module-name>
</properties>

<build>
<plugins>
<plugin>
Expand Down Expand Up @@ -52,4 +56,4 @@

</build>

</project>
</project>
File renamed without changes.
6 changes: 5 additions & 1 deletion slf4j-jdk14/pom.xml
Expand Up @@ -16,6 +16,10 @@
<description>SLF4J JDK14 Binding</description>
<url>http://www.slf4j.org</url>

<properties>
<module-name>org.slf4j.jul</module-name>
</properties>

<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
Expand All @@ -31,4 +35,4 @@
</dependency>
</dependencies>

</project>
</project>
File renamed without changes.
6 changes: 5 additions & 1 deletion slf4j-nop/pom.xml
Expand Up @@ -17,11 +17,15 @@
<description>SLF4J NOP Binding</description>
<url>http://www.slf4j.org</url>

<properties>
<module-name>org.slf4j.nop</module-name>
</properties>

<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
</dependencies>

</project>
</project>
File renamed without changes.
6 changes: 5 additions & 1 deletion slf4j-simple/pom.xml
Expand Up @@ -16,6 +16,10 @@
<description>SLF4J Simple binding</description>
<url>http://www.slf4j.org</url>

<properties>
<module-name>org.slf4j.simple</module-name>
</properties>

<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
Expand All @@ -31,4 +35,4 @@
</dependency>
</dependencies>

</project>
</project>
File renamed without changes.
23 changes: 22 additions & 1 deletion slf4j-site/pom.xml
Expand Up @@ -38,7 +38,28 @@
<outputDirectory>${project.parent.basedir}/target/site</outputDirectory>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>${maven-source-plugin.version}</version>
<configuration>
<!-- Maven central does not allow entries with ../.. in
*-source.jar but requires that they exist. -->
<includes>
<include>**/META-INF/*</include>
</includes>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
</project>
6 changes: 3 additions & 3 deletions slf4j-site/src/site/pages/download.html
Expand Up @@ -43,12 +43,12 @@ <h3>Would you like to subscribe to the QOS.CH announcements mailing

<h2>Latest STABLE version</h2>

<p>Download version ${stable.version} including <i>full source code</i>,
<p>Download version ${latest.stable.version} including <i>full source code</i>,
class files and documentation in ZIP or TAR.GZ format: </p>

<ul>
<li><a href="dist/slf4j-${stable.version}.tar.gz"><b>slf4j-${stable.version}.tar.gz</b></a> </li>
<li><a href="dist/slf4j-${stable.version}.zip"><b>slf4j-${stable.version}.zip</b></a> </li>
<li><a href="dist/slf4j-${latest.stable.version}.tar.gz"><b>slf4j-${latest.stable.version}.tar.gz</b></a> </li>
<li><a href="dist/slf4j-${latest.stable.version}.zip"><b>slf4j-${latest.stable.version}.zip</b></a> </li>
</ul>

<h2>Java 9 Modularized EXPERIMENTAL version</h2>
Expand Down

0 comments on commit fb418db

Please sign in to comment.