janklab / slf4m-jankalog

Modified forks of FLOSS logging libraries to support SLF4M
Other
0 stars 0 forks source link

Munged opp SLF4J and log4j library building #4

Open apjanke opened 2 years ago

apjanke commented 2 years ago

This ticket is for building the "munged" SLF4J and log4j libraries that will ship with SLF4M to support newer Matlab versions. Blocks janklab/SLF4M#7, janklab/SLF4M#15.

Work is on branch WIP/log4j2. NOTE: Because this is a "WIP" branch, I may be rebasing, squashing, and rewriting history on this branch at any time. You'll need to frequently delete your local tracking branch and check it out again if you're following along here. (This branch was imported from the old branch WIP/munged-java-libs-for-R2021a in the main SLF4M repo.

I'm getting log4j 1.2.15 going first.

Questions

IDEA! Can I create just a munged SLF4J 1.5 library, have it bind to the real log4j 1.x, and ship the real log4j 1.x? log4j 1.x and 2.x have different package names; maybe they can both run in the same JVM program. Hmm, let's try that. UPDATE: Rats, I think No: Matlab is shipping the log4j 1.x-to-2.x bridge JAR, which consumes the log4j 1.x package namespace.

Plans (Summary)

TODO

Subtasks

apjanke commented 2 years ago

Getting log4j going first, using the instructions in the BUILD-INFO.txt file in its source tree.

Off the bat, the mvn build is failing.

[apache-log4j-1.2.15] $ mvn site assembly:assembly
[INFO] Scanning for projects...
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 135, column 15
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-surefire-plugin is missing. @ line 81, column 15
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-jar-plugin is missing. @ line 142, column 12
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-source-plugin is missing. @ line 324, column 15
[WARNING] 'build.plugins.plugin.version' for org.codehaus.mojo:clirr-maven-plugin is missing. @ line 341, column 15
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-javadoc-plugin is missing. @ line 313, column 15
[WARNING] 'build.plugins.plugin.version' for org.codehaus.mojo:rat-maven-plugin is missing. @ line 348, column 15
[ERROR] 'build.plugins.plugin[org.apache.maven.plugins:maven-antrun-plugin].dependencies.dependency.scope' for junit:junit:jar must be one of [compile, runtime, system] but is 'test'. @ line 286, column 21
[WARNING] 'build.plugins.plugin[org.apache.maven.plugins:maven-antrun-plugin].dependencies.dependency.systemPath' for sun.jdk:tools:jar refers to a non-existing file /Library/Java/JavaVirtualMachines/adoptopenjdk-16.jdk/Contents/Home/../Classes/classes.jar. Please verify that you run Maven using a JDK and not just a JRE. @ line 293, column 23
[WARNING] 'repositories.repository.layout' for java.net uses the unsupported value 'legacy', artifact resolution might fail. @ line 384, column 13
 @
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR]   The project log4j:log4j:1.2.15 (/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/pom.xml) has 1 error
[ERROR]     'build.plugins.plugin[org.apache.maven.plugins:maven-antrun-plugin].dependencies.dependency.scope' for junit:junit:jar must be one of [compile, runtime, system] but is 'test'. @ line 286, column 21
[...]
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
[apache-log4j-1.2.15] $

I'm running under Maven 3. This log4j project was written for Maven 2, per BUILD-INFO.txt. Trying Maven 2. Had to set $JAVA_HOME.

[apache-log4j-1.2.15] $ export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)
[apache-log4j-1.2.15] $ mvn2 --version
Apache Maven 2.2.1 (r801777; 2009-08-06 15:16:01-0400)
Java version: 1.8.0_292
Java home: /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x" version: "10.14.6" arch: "x86_64" Family: "mac"
[apache-log4j-1.2.15] $

Maven plugin error.

[apache-log4j-1.2.15] $ mvn2 site assembly:assembly
[INFO] Scanning for projects...
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-surefire-plugin/2.4.3/maven-surefire-plugin-2.4.3.pom
[WARNING] Unable to get resource 'org.apache.maven.plugins:maven-surefire-plugin:pom:2.4.3' from repository central (http://repo1.maven.org/maven2): Error transferring file: Server returned HTTP response code: 501 for URL: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-surefire-plugin/2.4.3/maven-surefire-plugin-2.4.3.pom
Downloading: https://maven-repository.dev.java.net/nonav/repository/org.apache.maven.plugins/poms/maven-surefire-plugin-2.4.3.pom
[WARNING] Unable to get resource 'org.apache.maven.plugins:maven-surefire-plugin:pom:2.4.3' from repository java.net (https://maven-repository.dev.java.net/nonav/repository): Error transferring file: No subject alternative DNS name matching maven-repository.dev.java.net found.
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-surefire-plugin/2.4.3/maven-surefire-plugin-2.4.3.pom
[WARNING] Unable to get resource 'org.apache.maven.plugins:maven-surefire-plugin:pom:2.4.3' from repository central (http://repo1.maven.org/maven2): Error transferring file: Server returned HTTP response code: 501 for URL: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-surefire-plugin/2.4.3/maven-surefire-plugin-2.4.3.pom
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).

Project ID: org.apache.maven.plugins:maven-surefire-plugin

Reason: POM 'org.apache.maven.plugins:maven-surefire-plugin' not found in repository: Unable to download the artifact from any repository

  org.apache.maven.plugins:maven-surefire-plugin:pom:2.4.3

from the specified remote repositories:
  central (http://repo1.maven.org/maven2),
  java.net (https://maven-repository.dev.java.net/nonav/repository)

 for project org.apache.maven.plugins:maven-surefire-plugin

[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: < 1 second
[INFO] Finished at: Sat Sep 10 13:21:49 EDT 2022
[INFO] Final Memory: 17M/1963M
[INFO] ------------------------------------------------------------------------
[apache-log4j-1.2.15] $

Hmm. Does that mean that the repos for maven2 plugins are offline? Sigh.

Going to http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-surefire-plugin/2.4.3/maven-surefire-plugin-2.4.3.pom in a browser, I get:

501 HTTPS Required. 
Use https://repo1.maven.org/maven2/
More information at https://links.sonatype.com/central/501-https-required

That "more information" link says:

If you're receiving this error, then you need to replace all URL references to Maven Central with their canonical HTTPS counterparts:

Replace http://repo1.maven.org/maven2/ with https://repo1.maven.org/maven2/

Replace http://repo.maven.apache.org/maven2/ with https://repo.maven.apache.org/maven2/

So hmm, I wonder where my maven2 is picking up the http link from? I don't see these maven repos listed in the pom.xml anywhere.

Googling around, it doesn't seem like you can change maven2's central repo url; only add alternate repos. I tried doing this in the project pom.xml like this:

    <repository>
      <id>maven-central-https</id>
      <url>https://repo1.maven.org/maven2</url>
    </repository>
    <repository>
      <id>apache-maven-https</id>
      <url>https://repo.maven.apache.org/maven2</url>
    </repository>

But still getting download failures.

[apache-log4j-1.2.15] $ mvn2 site assembly:assembly
[INFO] Scanning for projects...
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-surefire-plugin/2.4.3/maven-surefire-plugin-2.4.3.jar
[WARNING] Unable to get resource 'org.apache.maven.plugins:maven-surefire-plugin:maven-plugin:2.4.3' from repository central (http://repo1.maven.org/maven2): Error transferring file: Server returned HTTP response code: 501 for URL: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-surefire-plugin/2.4.3/maven-surefire-plugin-2.4.3.jar
[INFO] Cannot find mojo descriptor for: 'assembly:assembly' - Treating as non-aggregator.
[INFO] ------------------------------------------------------------------------
[INFO] Building Janklab-Munged Apache Log4j
[INFO]    task-segment: [site, assembly:assembly]
[INFO] ------------------------------------------------------------------------
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-site-plugin/2.0-beta-7/maven-site-plugin-2.0-beta-7.jar
[WARNING] Unable to get resource 'org.apache.maven.plugins:maven-site-plugin:maven-plugin:2.0-beta-7' from repository central (http://repo1.maven.org/maven2): Error transferring file: Server returned HTTP response code: 501 for URL: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-site-plugin/2.0-beta-7/maven-site-plugin-2.0-beta-7.jar
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] A required plugin was not found: Plugin could not be found - check that the goal name is correct: Unable to download the artifact from any repository

Aha! I think it needs to be <pluginRepositories>, not <repositories>.

  <pluginRepositories>
    <pluginRepository>
      <id>maven-central-https</id>
      <url>https://repo1.maven.org/maven2</url>
    </pluginRepository>
    <pluginRepository>
      <id>apache-maven-https</id>
      <url>https://repo.maven.apache.org/maven2</url>
    </pluginRepository>
  </pluginRepositories>

The build is still failing, but it seems to be getting through the Maven plugin download steps and getting much further now.

apjanke commented 2 years ago

The maven-repository.dev.java.net Maven repo is dead. The whole java.net site closed down in 2016 or 2017. Thanks Oracle.

Downloading: https://maven-repository.dev.java.net/nonav/repository/javax.jms/jars/jms-1.1.jar
Downloading: https://maven-repository.dev.java.net/nonav/repository/com.sun.jdmk/jars/jmxtools-1.2.1.jar
Downloading: https://maven-repository.dev.java.net/nonav/repository/com.sun.jmx/jars/jmxri-1.2.1.jar
[WARNING] Unable to get resource 'com.sun.jdmk:jmxtools:jar:1.2.1' from repository java.net (https://maven-repository.dev.java.net/nonav/repository): Error transferring file: No subject alternative DNS name matching maven-repository.dev.java.net found.
[WARNING] Unable to get resource 'javax.jms:jms:jar:1.1' from repository java.net (https://maven-repository.dev.java.net/nonav/repository): Error transferring file: No subject alternative DNS name matching maven-repository.dev.java.net found.
[WARNING] Unable to get resource 'com.sun.jmx:jmxri:jar:1.2.1' from repository java.net (https://maven-repository.dev.java.net/nonav/repository): Error transferring file: No subject alternative DNS name matching maven-repository.dev.java.net found.
[...]
[INFO] Failed to resolve artifact.

Missing:
----------
1) com.sun.jmx:jmxri:jar:1.2.1

  Try downloading the file manually from the project website.

  Then, install it using the command:
      mvn install:install-file -DgroupId=com.sun.jmx -DartifactId=jmxri -Dversion=1.2.1 -Dpackaging=jar -Dfile=/path/to/file

  Alternatively, if you host your own repository you can deploy the file there:
      mvn deploy:deploy-file -DgroupId=com.sun.jmx -DartifactId=jmxri -Dversion=1.2.1 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

  Path to dependency:
    1) net.janklab.opp.log4j:log4j:jar:1.2.15
    2) com.sun.jmx:jmxri:jar:1.2.1

Looks like these JARs were removed from some of the public Maven repos due to Java/Oracle licensing issues.

References:

I could try to find another place they're hosted, or do the download-and-install-locally thing. Or it looks like maybe log4j 1.2.17 fixes this problem, and I could use that version instead?

The official Oracle download site for these things looks like https://www.oracle.com/java/technologies/java-archive-downloads-java-plat-downloads.html now. I can't find an authoritative SHA sum for these JAR files so I can verify copies acquired from other sources. But I think I can just take the JARs from oracle.com as authoritative if I can find all of them.

This Oracle "Getting Started with JMX" page says that JMX is included with Java starting with Java 5, so maybe it's not even needed now if I build against a newer JDK? Apache log4j 1.2.15 looks like it's targeting an ancient pre-Java-5 Java version:

      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>1.2</source>
          <target>1.1</target>
        </configuration>
      </plugin>

Here's some download locations I've found so far:

Okay, so those download sources all look good.

That http://builds.archive.org/maven2/ repo looks interesting, too.

I downloaded the JMX JARs from oracle.com and installed them in my local ~/.m2 maven2 repo. Looks like that worked! The build is getting further now.

[apache-log4j-1.2.15] $ mvn2 site assembly:assembly
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Janklab-Munged Apache Log4j
[INFO]    task-segment: [site]
[INFO] ------------------------------------------------------------------------
[INFO] artifact org.apache.maven.plugins:maven-project-info-reports-plugin: checking for updates from central
[WARNING] repository metadata for: 'artifact org.apache.maven.plugins:maven-project-info-reports-plugin' could not be retrieved from repository: central due to an error: Error transferring file: repo1.maven.apache.org
[INFO] Repository 'central' will be blacklisted
[INFO] Ignoring available plugin update: 3.4.1 as it requires Maven version 3.2.5
[INFO] Ignoring available plugin update: 3.4.0 as it requires Maven version 3.2.5
[INFO] Ignoring available plugin update: 3.3.0 as it requires Maven version 3.2.5
[INFO] Ignoring available plugin update: 3.2.2 as it requires Maven version 3.0
[INFO] Ignoring available plugin update: 3.2.1 as it requires Maven version 3.0
[INFO] Ignoring available plugin update: 3.1.2 as it requires Maven version 3.0
[INFO] Ignoring available plugin update: 3.1.1 as it requires Maven version 3.0
[INFO] Ignoring available plugin update: 3.1.0 as it requires Maven version 3.0
[INFO] Ignoring available plugin update: 3.0.0 as it requires Maven version 3.0
[INFO] Ignoring available plugin update: 3.0.0-M6 as it requires Maven version 3.2.5
[INFO] Ignoring available plugin update: 3.0.0-M5 as it requires Maven version 3.0
[INFO] Ignoring available plugin update: 3.0.0-M4 as it requires Maven version 3.0
[INFO] Ignoring available plugin update: 3.0.0-M1 as it requires Maven version 3.0
[INFO] [site:site {execution: default-site}]
[WARNING] Error loading report org.apache.maven.plugin.jxr.JxrReport - AbstractMethodError: canGenerateReport()
[INFO] artifact org.apache.maven.skins:maven-default-skin: checking for updates from central
[WARNING] repository metadata for: 'artifact org.apache.maven.skins:maven-default-skin' could not be retrieved from repository: central due to an error: Error transferring file: repo1.maven.apache.org
[INFO] Repository 'central' will be blacklisted
[INFO] Generating "Source Code Management" report.
[INFO] Generating "Dependencies" report.
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] 1
[INFO] ------------------------------------------------------------------------
[INFO] Trace
java.lang.ArrayIndexOutOfBoundsException: 1
    at org.apache.maven.doxia.module.xhtml.XhtmlSink.tableCell(XhtmlSink.java:791)
    at org.apache.maven.doxia.module.xhtml.XhtmlSink.tableHeaderCell(XhtmlSink.java:777)
    at org.apache.maven.reporting.AbstractMavenReportRenderer.tableHeaderCell(AbstractMavenReportRenderer.java:271)
    at org.apache.maven.reporting.AbstractMavenReportRenderer.tableHeader(AbstractMavenReportRenderer.java:360)
    at org.apache.maven.report.projectinfo.dependencies.renderer.DependenciesRenderer.renderDependenciesForScope(DependenciesRenderer.java:849)
    at org.apache.maven.report.projectinfo.dependencies.renderer.DependenciesRenderer.renderDependenciesForAllScopes(DependenciesRenderer.java:427)
    at org.apache.maven.report.projectinfo.dependencies.renderer.DependenciesRenderer.renderSectionProjectDependencies(DependenciesRenderer.java:411)
    at org.apache.maven.report.projectinfo.dependencies.renderer.DependenciesRenderer.renderBody(DependenciesRenderer.java:226)
    at org.apache.maven.reporting.AbstractMavenReportRenderer.render(AbstractMavenReportRenderer.java:83)
    at org.apache.maven.report.projectinfo.DependenciesReport.executeReport(DependenciesReport.java:201)
    at org.apache.maven.reporting.AbstractMavenReport.generate(AbstractMavenReport.java:255)
    at org.apache.maven.reporting.AbstractMavenReport.generate(AbstractMavenReport.java:210)
    at org.apache.maven.plugins.site.ReportDocumentRenderer.renderDocument(ReportDocumentRenderer.java:139)
    at org.apache.maven.doxia.siterenderer.DefaultSiteRenderer.renderModule(DefaultSiteRenderer.java:269)
    at org.apache.maven.doxia.siterenderer.DefaultSiteRenderer.render(DefaultSiteRenderer.java:101)
    at org.apache.maven.plugins.site.SiteMojo.renderLocale(SiteMojo.java:133)
    at org.apache.maven.plugins.site.SiteMojo.execute(SiteMojo.java:100)
    at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
    at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
    at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
    at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
    at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3 seconds
[INFO] Finished at: Sat Sep 10 16:59:42 EDT 2022
[INFO] Final Memory: 89M/3500M
[INFO] ------------------------------------------------------------------------
[apache-log4j-1.2.15] $
apjanke commented 2 years ago

I tried to use a mirror in my ~/.m2/settings.xml to repoint Central at https access and avoid warnings.

     <mirror>
      <id>central-https</id>
      <name>Maven Central Repository (HTTPS access)</name>
      <url>https://repo1.maven.apache.org/maven2</url>
      <mirrorOf>central</mirrorOf>
    </mirror>
  </mirrors>

But it didn't fully work. I'm still getting this.

[apache-log4j-1.2.15] $ mvn2 site assembly:assembly
[...]
[INFO] artifact org.codehaus.mojo:clirr-maven-plugin: checking for updates from central
[WARNING] repository metadata for: 'artifact org.codehaus.mojo:clirr-maven-plugin' could not be retrieved from repository: central due to an error: Error transferring file: repo1.maven.apache.org
[INFO] Repository 'central' will be blacklisted

I deleted my local mvn2 repo and reran it, to get everything fresh. Similar issues, and even more of them now. I bet this is more stuff that was removed due to Java licensing issues but I had in my local maven2 repo.

Downloading: https://repo1.maven.apache.org/maven2/javax/mail/mail/1.4/mail-1.4.pom
[WARNING] Unable to get resource 'javax.mail:mail:pom:1.4' from repository central (http://repo1.maven.org/maven2): Error transferring file: repo1.maven.apache.org
Downloading: https://repo1.maven.apache.org/maven2/javax/jms/jms/1.1/jms-1.1.pom
[WARNING] Unable to get resource 'javax.jms:jms:pom:1.1' from repository central (http://repo1.maven.org/maven2): Error transferring file: repo1.maven.apache.org
Downloading: https://repo1.maven.apache.org/maven2/com/sun/jdmk/jmxtools/1.2.1/jmxtools-1.2.1.pom
[WARNING] Unable to get resource 'com.sun.jdmk:jmxtools:pom:1.2.1' from repository central (http://repo1.maven.org/maven2): Error transferring file: repo1.maven.apache.org
Downloading: https://repo1.maven.apache.org/maven2/com/sun/jmx/jmxri/1.2.1/jmxri-1.2.1.pom
[WARNING] Unable to get resource 'com.sun.jmx:jmxri:pom:1.2.1' from repository central (http://repo1.maven.org/maven2): Error transferring file: repo1.maven.apache.org
Downloading: https://repo1.maven.apache.org/maven2/javax/mail/mail/1.4/mail-1.4.jar
Downloading: https://repo1.maven.apache.org/maven2/junit/junit/3.8.1/junit-3.8.1.jar
Downloading: https://repo1.maven.apache.org/maven2/com/sun/jmx/jmxri/1.2.1/jmxri-1.2.1.jar
Downloading: https://repo1.maven.apache.org/maven2/javax/jms/jms/1.1/jms-1.1.jar
Downloading: https://repo1.maven.apache.org/maven2/com/sun/jdmk/jmxtools/1.2.1/jmxtools-1.2.1.jar
[WARNING] Unable to get resource 'javax.mail:mail:jar:1.4' from repository central (http://repo1.maven.org/maven2): Error transferring file: repo1.maven.apache.org
[WARNING] Unable to get resource 'com.sun.jmx:jmxri:jar:1.2.1' from repository central (http://repo1.maven.org/maven2): Error transferring file: repo1.maven.apache.org
[WARNING] Unable to get resource 'junit:junit:jar:3.8.1' from repository central (http://repo1.maven.org/maven2): Error transferring file: repo1.maven.apache.org
[WARNING] Unable to get resource 'javax.jms:jms:jar:1.1' from repository central (http://repo1.maven.org/maven2): Error transferring file: repo1.maven.apache.org
[WARNING] Unable to get resource 'com.sun.jdmk:jmxtools:jar:1.2.1' from repository central (http://repo1.maven.org/maven2): Error transferring file: repo1.maven.apache.org

Oh wait, duh: the https versions of the central repo need to be in <repositories> as well as <pluginRepositories>. Added this, and all the new errors went away:

  <repositories>
    [...]
    <repository>
      <id>maven-central-https</id>
      <url>https://repo1.maven.org/maven2</url>
    </repository>
    <repository>
      <id>apache-maven-https</id>
      <url>https://repo.maven.apache.org/maven2</url>
    </repository>

I'm left with the com.sun.jmx:jmxri:jar:1.2.1 and com.sun.jdmk:jmxtools:jar:1.2.1 errors.

I haven't been able to find any public Maven repo where they're hosted. And I don't want to fiddle with the project definition. So I think I'll just go the route of manually downloading them and installing them in my local m2 repo.

apjanke commented 2 years ago

Also needed JMS 1.1. I don't see a download for that on Oracle's site. (There's a JMS 1.0 on the J2EE download page, but that's the wrong version.) There's a JMS 1.1 JAR available in the JBoss Maven repo, so I'm going with that. JMS is Java Message Service.

$ shasum -a 256 ~/.m2/repository/javax/jms/jms/1.1/jms-1.1.jar
7de11aa5fb1c51133ba6c1fe96bd296eeea5d86ccb862cc9a5274aa943c91548  /Users/janke/.m2/repository/javax/jms/jms/1.1/jms-1.1.jar

Build is getting much further now!

[INFO] [site:site {execution: default-site}]
[WARNING] Error loading report org.apache.maven.plugin.jxr.JxrReport - AbstractMethodError: canGenerateReport()
[INFO] artifact org.apache.maven.skins:maven-default-skin: checking for updates from central
[WARNING] repository metadata for: 'artifact org.apache.maven.skins:maven-default-skin' could not be retrieved from repository: central due to an error: Error transferring file: repo1.maven.apache.org
[INFO] Repository 'central' will be blacklisted
[INFO] Generating "Source Code Management" report.
[INFO] Generating "Dependencies" report.
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] 1
[INFO] ------------------------------------------------------------------------
[INFO] Trace
java.lang.ArrayIndexOutOfBoundsException: 1
    at org.apache.maven.doxia.module.xhtml.XhtmlSink.tableCell(XhtmlSink.java:791)
    at org.apache.maven.doxia.module.xhtml.XhtmlSink.tableHeaderCell(XhtmlSink.java:777)
    at org.apache.maven.reporting.AbstractMavenReportRenderer.tableHeaderCell(AbstractMavenReportRenderer.java:271)
    at org.apache.maven.reporting.AbstractMavenReportRenderer.tableHeader(AbstractMavenReportRenderer.java:360)
apjanke commented 2 years ago

Looks like the identifiers for maven plugins have changed since the time of log4j 1.2? The artifactId for the JXR plugin is different, and they're now under group org.apache.maven.plugins instead of org.codehaus.mojo. I updated the references in the pom.xml to what I think are the current plugin identifiers, and added version specifiers to grab the latest version of each that supports Maven 2.

apjanke commented 2 years ago

Okay, now what's causing this?

[apache-log4j-1.2.15] $ mvn2 site assembly:assembly
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Janklab-Munged Apache Log4j
[INFO]    task-segment: [site]
[INFO] ------------------------------------------------------------------------
[INFO] [site:site {execution: default-site}]
[INFO] artifact org.apache.maven.skins:maven-default-skin: checking for updates from central
[WARNING] repository metadata for: 'artifact org.apache.maven.skins:maven-default-skin' could not be retrieved from repository: central due to an error: Error transferring file: repo1.maven.apache.org
[INFO] Repository 'central' will be blacklisted
[INFO] Skipped "Source Xref" report, file "xref/index.html" already exists for the English version.
[INFO] Skipped "Test Source Xref" report, file "xref-test/index.html" already exists for the English version.
[INFO] Generating "Test Source Xref" report.
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Generating "Source Repository" report.
[WARNING] Deprecated API called - not org.apache.maven.doxia.sink.Sink instance and no SinkFactory available. Please update this plugin.
[INFO] Generating "Mailing Lists" report.
[WARNING] Deprecated API called - not org.apache.maven.doxia.sink.Sink instance and no SinkFactory available. Please update this plugin.
[INFO] Generating "Dependencies" report.
[WARNING] Deprecated API called - not org.apache.maven.doxia.sink.Sink instance and no SinkFactory available. Please update this plugin.
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] 1
[INFO] ------------------------------------------------------------------------
[INFO] Trace
java.lang.ArrayIndexOutOfBoundsException: 1
    at org.apache.maven.doxia.module.xhtml.XhtmlSink.tableCell(XhtmlSink.java:791)
    at org.apache.maven.doxia.module.xhtml.XhtmlSink.tableHeaderCell(XhtmlSink.java:777)
    at org.apache.maven.reporting.AbstractMavenReportRenderer.tableHeaderCell(AbstractMavenReportRenderer.java:267)
    at org.apache.maven.reporting.AbstractMavenReportRenderer.tableHeader(AbstractMavenReportRenderer.java:356)
    at org.apache.maven.report.projectinfo.dependencies.renderer.DependenciesRenderer.renderDependenciesForScope(DependenciesRenderer.java:787)
    at org.apache.maven.report.projectinfo.dependencies.renderer.DependenciesRenderer.renderDependenciesForAllScopes(DependenciesRenderer.java:449)
    at org.apache.maven.report.projectinfo.dependencies.renderer.DependenciesRenderer.renderSectionProjectDependencies(DependenciesRenderer.java:433)

The org.apache.maven.report.projectinfo.DependenciesReport in the stack makes me think this is coming from the maven-project-info-reports-plugin plugin.

I bumped maven-project-info-reports-plugin to version 2.9, the last version that supports Maven 2. Same error.

Here's some debug output.

[apache-log4j-1.2.15] $ mvn2 --debug site assembly:assembly
[...]

[DEBUG] Velocimacro : added #breadcrumbs(  breadcrumbs ) : source = org/apache/maven/doxia/siterenderer/resources/default-site.vm
[DEBUG] Velocimacro : added #displayTree(  display item ) : source = org/apache/maven/doxia/siterenderer/resources/default-site.vm
[DEBUG] Velocimacro : added #menuItem(  item ) : source = org/apache/maven/doxia/siterenderer/resources/default-site.vm
[DEBUG] Velocimacro : added #mainMenu(  menus ) : source = org/apache/maven/doxia/siterenderer/resources/default-site.vm
[DEBUG] Velocimacro : added #copyright(  ) : source = org/apache/maven/doxia/siterenderer/resources/default-site.vm
[DEBUG] Velocimacro : added #publishDate(  position publishDate version ) : source = org/apache/maven/doxia/siterenderer/resources/default-site.vm
[DEBUG] Velocimacro : added #poweredByLogo(  poweredBy ) : source = org/apache/maven/doxia/siterenderer/resources/default-site.vm
[DEBUG] Generating /Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/target/site/dependencies.html
[INFO] Generating "Dependencies" report.
[DEBUG] building maven2 dependency graph for net.janklab.opp.log4j:log4j:jar:1.2.15 with Maven2DependencyGraphBuilder
[DEBUG] Dependency tree resolution listener events:
[DEBUG] testArtifact: artifact=net.janklab.opp.log4j:log4j:jar:1.2.15
[DEBUG] includeArtifact: artifact=net.janklab.opp.log4j:log4j:jar:1.2.15
[DEBUG] startProcessChildren: artifact=net.janklab.opp.log4j:log4j:jar:1.2.15
[DEBUG]   testArtifact: artifact=javax.mail:mail:jar:1.4:compile
[DEBUG]   includeArtifact: artifact=javax.mail:mail:jar:1.4:compile
[DEBUG]   startProcessChildren: artifact=javax.mail:mail:jar:1.4:compile
[DEBUG]     testArtifact: artifact=javax.activation:activation:jar:1.1:compile
[DEBUG]     includeArtifact: artifact=javax.activation:activation:jar:1.1:compile
[DEBUG]     startProcessChildren: artifact=javax.activation:activation:jar:1.1:compile
[DEBUG]     endProcessChildren: artifact=javax.activation:activation:jar:1.1:compile
[DEBUG]   endProcessChildren: artifact=javax.mail:mail:jar:1.4:compile
[DEBUG]   testArtifact: artifact=javax.jms:jms:jar:1.1:compile
[DEBUG]   includeArtifact: artifact=javax.jms:jms:jar:1.1:compile
[DEBUG]   startProcessChildren: artifact=javax.jms:jms:jar:1.1:compile
[DEBUG]   endProcessChildren: artifact=javax.jms:jms:jar:1.1:compile
[DEBUG]   testArtifact: artifact=com.sun.jdmk:jmxtools:jar:1.2.1:compile
[DEBUG]   includeArtifact: artifact=com.sun.jdmk:jmxtools:jar:1.2.1:compile
[DEBUG]   startProcessChildren: artifact=com.sun.jdmk:jmxtools:jar:1.2.1:compile
[DEBUG]   endProcessChildren: artifact=com.sun.jdmk:jmxtools:jar:1.2.1:compile
[DEBUG]   testArtifact: artifact=com.sun.jmx:jmxri:jar:1.2.1:compile
[DEBUG]   includeArtifact: artifact=com.sun.jmx:jmxri:jar:1.2.1:compile
[DEBUG]   startProcessChildren: artifact=com.sun.jmx:jmxri:jar:1.2.1:compile
[DEBUG]   endProcessChildren: artifact=com.sun.jmx:jmxri:jar:1.2.1:compile
[DEBUG]   testArtifact: artifact=oro:oro:jar:2.0.8:test
[DEBUG]   includeArtifact: artifact=oro:oro:jar:2.0.8:test
[DEBUG]   startProcessChildren: artifact=oro:oro:jar:2.0.8:test
[DEBUG]   endProcessChildren: artifact=oro:oro:jar:2.0.8:test
[DEBUG]   testArtifact: artifact=junit:junit:jar:3.8.1:test
[DEBUG]   includeArtifact: artifact=junit:junit:jar:3.8.1:test
[DEBUG]   startProcessChildren: artifact=junit:junit:jar:3.8.1:test
[DEBUG]   endProcessChildren: artifact=junit:junit:jar:3.8.1:test
[DEBUG] endProcessChildren: artifact=net.janklab.opp.log4j:log4j:jar:1.2.15
[DEBUG] building maven2 dependency graph for net.janklab.opp.log4j:log4j:jar:1.2.15 with Maven2DependencyGraphBuilder
[DEBUG] Dependency tree resolution listener events:
[DEBUG] testArtifact: artifact=net.janklab.opp.log4j:log4j:jar:1.2.15
[DEBUG] includeArtifact: artifact=net.janklab.opp.log4j:log4j:jar:1.2.15
[DEBUG] startProcessChildren: artifact=net.janklab.opp.log4j:log4j:jar:1.2.15
[DEBUG]   testArtifact: artifact=javax.mail:mail:jar:1.4:compile
[DEBUG]   includeArtifact: artifact=javax.mail:mail:jar:1.4:compile
[DEBUG]   startProcessChildren: artifact=javax.mail:mail:jar:1.4:compile
[DEBUG]     testArtifact: artifact=javax.activation:activation:jar:1.1:compile
[DEBUG]     includeArtifact: artifact=javax.activation:activation:jar:1.1:compile
[DEBUG]     startProcessChildren: artifact=javax.activation:activation:jar:1.1:compile
[DEBUG]     endProcessChildren: artifact=javax.activation:activation:jar:1.1:compile
[DEBUG]   endProcessChildren: artifact=javax.mail:mail:jar:1.4:compile
[DEBUG]   testArtifact: artifact=javax.jms:jms:jar:1.1:compile
[DEBUG]   includeArtifact: artifact=javax.jms:jms:jar:1.1:compile
[DEBUG]   startProcessChildren: artifact=javax.jms:jms:jar:1.1:compile
[DEBUG]   endProcessChildren: artifact=javax.jms:jms:jar:1.1:compile
[DEBUG]   testArtifact: artifact=com.sun.jdmk:jmxtools:jar:1.2.1:compile
[DEBUG]   includeArtifact: artifact=com.sun.jdmk:jmxtools:jar:1.2.1:compile
[DEBUG]   startProcessChildren: artifact=com.sun.jdmk:jmxtools:jar:1.2.1:compile
[DEBUG]   endProcessChildren: artifact=com.sun.jdmk:jmxtools:jar:1.2.1:compile
[DEBUG]   testArtifact: artifact=com.sun.jmx:jmxri:jar:1.2.1:compile
[DEBUG]   includeArtifact: artifact=com.sun.jmx:jmxri:jar:1.2.1:compile
[DEBUG]   startProcessChildren: artifact=com.sun.jmx:jmxri:jar:1.2.1:compile
[DEBUG]   endProcessChildren: artifact=com.sun.jmx:jmxri:jar:1.2.1:compile
[DEBUG]   testArtifact: artifact=oro:oro:jar:2.0.8:test
[DEBUG]   includeArtifact: artifact=oro:oro:jar:2.0.8:test
[DEBUG]   startProcessChildren: artifact=oro:oro:jar:2.0.8:test
[DEBUG]   endProcessChildren: artifact=oro:oro:jar:2.0.8:test
[DEBUG]   testArtifact: artifact=junit:junit:jar:3.8.1:test
[DEBUG]   includeArtifact: artifact=junit:junit:jar:3.8.1:test
[DEBUG]   startProcessChildren: artifact=junit:junit:jar:3.8.1:test
[DEBUG]   endProcessChildren: artifact=junit:junit:jar:3.8.1:test
[DEBUG] endProcessChildren: artifact=net.janklab.opp.log4j:log4j:jar:1.2.15
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] 1
[INFO] ------------------------------------------------------------------------
[DEBUG] Trace
java.lang.ArrayIndexOutOfBoundsException: 1
    at org.apache.maven.doxia.module.xhtml.XhtmlSink.tableCell(XhtmlSink.java:791)
    at org.apache.maven.doxia.module.xhtml.XhtmlSink.tableHeaderCell(XhtmlSink.java:777)
    at org.apache.maven.reporting.AbstractMavenReportRenderer.tableHeaderCell(AbstractMavenReportRenderer.java:271)
    at org.apache.maven.reporting.AbstractMavenReportRenderer.tableHeader(AbstractMavenReportRenderer.java:360)
    at org.apache.maven.report.projectinfo.dependencies.renderer.DependenciesRenderer.renderDependenciesForScope(DependenciesRenderer.java:849)

Okay, so that's in the "Dependencies" report. I think that's requested by this in the pom.xml.

      <plugin>
        <artifactId>maven-project-info-reports-plugin</artifactId>
        <reportSets>
          <reportSet>
            <reports>
              <report>dependencies</report>

I don't see much else useful to me in that debug output. And I don't want to dig in to the source code to firgure out exactly where that ArrayIndexOutOfBoundsException is happening in the plugin implementation. Let's try to clean up these warnings and see if that helps.

[INFO] artifact org.apache.maven.skins:maven-default-skin: checking for updates from central
[WARNING] repository metadata for: 'artifact org.apache.maven.skins:maven-default-skin' could not be retrieved from repository: central due to an error: Error transferring file: repo1.maven.apache.org
[INFO] Repository 'central' will be blacklisted
[...]
[INFO] Generating "Test Source Xref" report.
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Generating "Source Code Management" report.

I tried this "add -Dhttps.protocols=TLSv1.2 to .mvn/jvm.config" trick. No behavior change.

I tweaked my pluginRepositories settings. Now I'm getting this:

[INFO] artifact org.apache.maven.skins:maven-default-skin: checking for updates from maven-apache-https
[INFO] artifact org.apache.maven.skins:maven-default-skin: checking for updates from central
[WARNING] repository metadata for: 'artifact org.apache.maven.skins:maven-default-skin' could not be retrieved from repository: central due to an error: Error transferring file: repo1.maven.apache.org
[INFO] Repository 'central' will be blacklisted

Which I think means that it is finding maven-default-skin on maven-apache-https, and that warning about central can be ignored, and this is a red herring for the dependency report.

I was able to find some other coders on the web with similar maven-project-info-reports-plugin/doxia ArrayIndexOutOfBoundsException issues:

No actual solutions there, though.

I tried using earlier versions of maven-project-info-reports-plugin going back to v2.2 and they all had the same error. Tried 2.1.2, and it worked! Got another dependency error, then.

[INFO] Generating "Test Source Xref" report.
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Generating "Source Repository" report.
[INFO] Generating "Mailing Lists" report.
[INFO] Generating "Dependencies" report.
[WARNING] The repository url 'http://repo1.maven.org/maven2' is invalid - Repository 'central' will be blacklisted.
[INFO] Generating "Continuous Integration" report.
[INFO] Generating "Issue Tracking" report.
[INFO] Generating "Project License" report.
[INFO] Generating "Source Xref" report.
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.

Missing:
----------
1) sun.jdk:tools:jar:1.4.2

  Try downloading the file manually from the project website.
[...]
  Path to dependency:
    1) org.apache.maven.plugins:maven-antrun-plugin:maven-plugin:1.3
    2) sun.jdk:tools:jar:1.4.2

That looks unrelated, so I'm going to stick with the older version and work this next bug out.

apjanke commented 2 years ago

Next up, this build failure about a missing sun.jdk:tools:jar:1.4.2 dependency.

[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.

Missing:
----------
1) sun.jdk:tools:jar:1.4.2

  Try downloading the file manually from the project website.

  Then, install it using the command:
      mvn install:install-file -DgroupId=sun.jdk -DartifactId=tools -Dversion=1.4.2 -Dpackaging=jar -Dfile=/path/to/file

  Alternatively, if you host your own repository you can deploy the file there:
      mvn deploy:deploy-file -DgroupId=sun.jdk -DartifactId=tools -Dversion=1.4.2 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

  Path to dependency:
    1) org.apache.maven.plugins:maven-antrun-plugin:maven-plugin:1.3
    2) sun.jdk:tools:jar:1.4.2

----------
1 required artifact is missing.

for artifact:
  org.apache.maven.plugins:maven-antrun-plugin:maven-plugin:1.3

Aha: log4j 1.2 is old enough that it was using the old Apple-distributed JDK paths in its configuration. In pom.xml, in <profiles>, "mac" profile, this fixed it:

       </activation>
       <properties>
-        <tools.jar>${java.home}/../Classes/classes.jar</tools.jar>
+        <tools.jar>${java.home}/../lib/tools.jar</tools.jar>
       </properties>

On to the next issue.

apjanke commented 2 years ago

Next up: a Java linkage error in org.codehaus.plexus.component.configurator.BasicComponentConfigurator, used by org.apache.maven.plugins:maven-antrun-plugin:1.3. I bet this antrun plugin or something it's using is too out of date to work with Java 8.

[INFO] Generating "Source Xref" report.
[FATAL ERROR] org.codehaus.plexus.component.configurator.BasicComponentConfigurator#configureComponent(...) caused a linkage error (java.lang.NoSuchMethodError) and may be out-of-date. Check the realms:
[FATAL ERROR] Plugin realm = app0.child-container[org.apache.maven.plugins:maven-antrun-plugin:1.3]
urls[0] = file:/Users/janke/.m2/repository/org/apache/maven/plugins/maven-antrun-plugin/1.3/maven-antrun-plugin-1.3.jar
urls[1] = file:/Users/janke/.m2/repository/ant/ant-nodeps/1.6.5/ant-nodeps-1.6.5.jar
urls[2] = file:/Users/janke/.m2/repository/ant-contrib/ant-contrib/1.0b2/ant-contrib-1.0b2.jar
urls[3] = file:/Users/janke/.m2/repository/ant/ant/1.5/ant-1.5.jar
urls[4] = file:/Users/janke/.m2/repository/ant/ant-junit/1.6.5/ant-junit-1.6.5.jar
urls[5] = file:/Users/janke/.m2/repository/junit/junit/3.8.1/junit-3.8.1.jar
urls[6] = file:/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/jre/../lib/tools.jar
urls[7] = file:/Users/janke/.m2/repository/org/codehaus/plexus/plexus-utils/1.5.6/plexus-utils-1.5.6.jar
urls[8] = file:/Users/janke/.m2/repository/org/apache/ant/ant-launcher/1.7.1/ant-launcher-1.7.1.jar
urls[9] = file:/Users/janke/.m2/repository/org/apache/ant/ant/1.7.1/ant-1.7.1.jar
[FATAL ERROR] Container realm = plexus.core
urls[0] = file:/opt/local/share/java/maven2/lib/maven-2.2.1-uber.jar
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error configuring: org.apache.maven.plugins:maven-antrun-plugin. Reason: java.lang.NoSuchMethodError: org.apache.tools.ant.util.FileUtils.close(Ljava/io/InputStream;)V
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6 seconds
[INFO] Finished at: Sat Sep 10 18:48:14 EDT 2022
[INFO] Final Memory: 82M/2381M
[INFO] ------------------------------------------------------------------------
[apache-log4j-1.2.15] $ grep -r 'http://repo1.maven.org' *
target/site/dependencies.html:<td align="left">http://repo1.maven.org/maven2</td>
[apache-log4j-1.2.15] $

Setting the maven-antrun-plugin to version 1.8 got rid of that error, but now I've got this:

$ mvn2 site
[...]
[INFO] Generating "Source Xref" report.
[INFO] [antrun:run {execution: untag-site}]
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error executing Ant tasks: org.apache.tools.ant.util.FileUtils.getFileUtils()Lorg/apache/tools/ant/util/FileUtils;

$ mvn2 -e site
[...]
[INFO] Generating "Source Xref" report.
[INFO] [antrun:run {execution: untag-site}]
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error executing Ant tasks: org.apache.tools.ant.util.FileUtils.getFileUtils()Lorg/apache/tools/ant/util/FileUtils;

[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Error executing Ant tasks: org.apache.tools.ant.util.FileUtils.getFileUtils()Lorg/apache/tools/ant/util/FileUtils;
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:719)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
    at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
    at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
    at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
    at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoExecutionException: Error executing Ant tasks: org.apache.tools.ant.util.FileUtils.getFileUtils()Lorg/apache/tools/ant/util/FileUtils;
    at org.apache.maven.plugin.antrun.AntRunMojo.execute(AntRunMojo.java:347)
    at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
    ... 17 more
Caused by: java.lang.NoSuchMethodError: org.apache.tools.ant.util.FileUtils.getFileUtils()Lorg/apache/tools/ant/util/FileUtils;
    at org.apache.tools.ant.taskdefs.Get.<clinit>(Get.java:62)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:264)
    at org.apache.tools.ant.Project.init(Project.java:269)
    at org.apache.maven.plugin.antrun.AntRunMojo.execute(AntRunMojo.java:251)
    ... 19 more

The next maven-antrun-plugin version after 1.8 is 3.0.0, and that requires Maven 3, so can't upgrade further to try to fix this.

The ant FileUtils Javadoc says getFileUtils was introduced in ant 1.6.3. The pom.xml here seems to be using ant 1.6.5. But maybe a further bump will help?

        <dependencies>
          <dependency>
            <groupId>ant</groupId>
            <artifactId>ant-nodeps</artifactId>
            <version>1.6.5</version>
          </dependency>
          <dependency>
            <groupId>ant-contrib</groupId>
            <artifactId>ant-contrib</artifactId>
            <version>1.0b2</version>
          </dependency>
          <dependency>
            <groupId>ant</groupId>
            <artifactId>ant-junit</artifactId>
            <version>1.6.5</version>
          </dependency>

Upgrading ant to version 1.7.1 seemed to fix it. Now I've got this regexp "opp/opp-munged/apache-log4j-1.2.15/target/site/apidocs does not exist" error.


[INFO] [antrun:run {execution: untag-site}]
[INFO] Executing tasks

main:
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] An Ant BuildException has occured: /Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/target/site/apidocs does not exist.
around Ant part ...<replaceregexp match="-- Generated by (.*) on .*--" replace="-- Generated by \1 --" flags="g">... @ 6:97 in /Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/target/antrun/build-main.xml

[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: An Ant BuildException has occured: /Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/target/site/apidocs does not exist.
around Ant part ...<replaceregexp match="-- Generated by (.*) on .*--" replace="-- Generated by \1 --" flags="g">... @ 6:97 in /Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/target/antrun/build-main.xml
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:719)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java

A mkdir -p target/site/apidocs got it to run to completion.


[INFO] [antrun:run {execution: untag-site}]
[INFO] Executing tasks

main:
[INFO] Executed tasks
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL

Seems like that shouldn't be necessary. I'm guessing a build task dependency here is missing. But I might just overlook this for now.

Here's the task definition for later reference.

          <!--   release builds will put SVN tags into the SCM page, this changes it back to a branch  -->
          <execution>
            <phase>site</phase>
            <id>untag-site</id>
            <configuration>
              <target>
                <taskdef name="replaceregexp" classname="org.apache.tools.ant.taskdefs.optional.ReplaceRegExp" />
                <replaceregexp file="target/site/source-repository.html" match="/tags/[^ ]*" replace="/trunk" flags="g" />
                <replaceregexp match="-- Generated by (.*) on .*--" replace="-- Generated by \1 --" flags="g">
                  <fileset dir="target/site/apidocs" includes="**/*.html" />
                </replaceregexp>
              </target>
            </configuration>
apjanke commented 2 years ago

Next: a test failure: "MinimumTestCase failed around Ant part ...".

    [junit] ------------- Standard Error -----------------
    [junit] log4j:ERROR Could not read configuration file from URL [file:/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/tests/output/urlbadescape.properties].
    [junit] java.lang.IllegalArgumentException: Malformed \uxxxx encoding.
    [junit]     at java.util.Properties.loadConvert(Properties.java:574)
    [junit]     at java.util.Properties.load0(Properties.java:391)
    [junit]     at java.util.Properties.load(Properties.java:341)
    [junit]     at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:460)
[...]
    [junit]     at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:420)
    [junit]     at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:911)
    [junit]     at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:768)
    [junit] log4j:ERROR Ignoring configuration file [file:/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/tests/output/urlbadescape.properties].
    [junit] log4j:ERROR Could not read configuration file [output/badescape.properties].
    [junit] java.lang.IllegalArgumentException: Malformed \uxxxx encoding.
    [junit]     at java.util.Properties.loadConvert(Properties.java:574)
    [junit]     at java.util.Properties.load0(Properties.java:391)
[...]
    [junit]     at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:420)
    [junit]     at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:911)
    [junit]     at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:768)
    [junit] log4j:ERROR Ignoring configuration file [output/badescape.properties].
    [junit] ------------- ---------------- ---------------
[...]
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] An Ant BuildException has occured: The following error occurred while executing this line:
/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/tests/build.xml:196: Test org.apache.log4j.MinimumTestCase failed
around Ant part ...<ant dir="tests" target="runAll">... @ 4:36 in /Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/target/antrun/build-main.xml

Oh wait, I think that's a red herring: looks like that test was to make sure that log4j did produce an error when presented with a bad escape. Here's what I think is the actual junit test error:

Minimum:
    [junit] WARNING: multiple versions of ant detected in path for junit
    [junit]          jar:file:/Users/janke/.m2/repository/org/apache/ant/ant/1.9.4/ant-1.9.4.jar!/org/apache/tools/ant/Project.class
    [junit]      and jar:file:/Users/janke/.m2/repository/ant/ant/1.5/ant-1.5.jar!/org/apache/tools/ant/Project.class
    [junit] Running org.apache.log4j.MinimumTestCase
    [junit] Testsuite: org.apache.log4j.MinimumTestCase
    [junit] Tests run: 2, Failures: 0, Errors: 1, Time elapsed: 0.042 sec
    [junit] Tests run: 2, Failures: 0, Errors: 1, Time elapsed: 0.042 sec
    [junit]
    [junit] Testcase: simple took 0.026 sec
    [junit] Testcase: ttcc took 0.012 sec
    [junit]     Caused an ERROR
    [junit] [10 Sep 2022 19:24:47,775 [main] FATAL ERR - Message 0]
    [junit] org.apache.log4j.util.UnexpectedFormatException: [10 Sep 2022 19:24:47,775 [main] FATAL ERR - Message 0]
    [junit]     at org.apache.log4j.util.ControlFilter.filter(ControlFilter.java:43)
    [junit]     at org.apache.log4j.util.Transformer.transform(Transformer.java:42)
    [junit]     at org.apache.log4j.MinimumTestCase.ttcc(MinimumTestCase.java:97)
    [junit]

Hmm. That "10 Sep 2022 19:37:10,797 [main] FATAL ERR - Message 0" is what's being produced by log4j running under the test harness in my environment. It's the ControlFilter that's throwing the exception. It has a list of patterns:

  static String EXCEPTION1 = "java.lang.Exception: Just testing";
  static String EXCEPTION2 = "\\s*at .*\\(.*:\\d{1,4}\\)";
  static String EXCEPTION3 = "\\s*at .*\\(Native Method\\)";
  static String EXCEPTION4 = "\\s*at .*\\(.*Compiled Code\\)";
  static String EXCEPTION5 = "\\s*at .*\\(.*libgcj.*\\)";

  //18 fevr. 2002 20:02:41,551 [main] FATAL ERR - Message 0
  static String TTCC_PAT = Filter.ABSOLUTE_DATE_AND_TIME_PAT+ 
              " \\[main]\\ (TRACE|DEBUG|INFO|WARN|ERROR|FATAL) .* - Message \\d{1,2}";
  static String TTCC2_PAT = Filter.ABSOLUTE_DATE_AND_TIME_PAT+ 
              " \\[main]\\ (TRACE|DEBUG|INFO|WARN|ERROR|FATAL) .* - Messages should bear numbers 0 through 29\\.";

That comment makes me think that one of the TTCC_PATs was intended to match this. Hmm.

Oh, look: in Filter.java:

  static public final String ABSOLUTE_DATE_AND_TIME_PAT = 
                           "^\\d{1,2} .{2,6}\\.? 200\\d \\d{2}:\\d{2}:\\d{2},\\d{3}";

It's using "200\d" as its pattern for 4-digit years. Hahahaha; did this break a decade ago?

Yep: I changed it to "20\d\d" and this test started passing. On to the next test failure.

apjanke commented 2 years ago

Let's get rid of this "multiple versions of ant" warning:

LevelMatchFilter:
    [junit] WARNING: multiple versions of ant detected in path for junit
    [junit]          jar:file:/Users/janke/.m2/repository/org/apache/ant/ant/1.9.4/ant-1.9.4.jar!/org/apache/tools/ant/Project.class
    [junit]      and jar:file:/Users/janke/.m2/repository/ant/ant/1.5/ant-1.5.jar!/org/apache/tools/ant/Project.class
    [junit] Running org.apache.log4j.varia.LevelMatchFilterTestCase

These look relevant:

I deleted my local Maven repo with rm -rf ~/.m2/repository and reran mvn2 test. Same warning. Need to figure out what's pulling in the two different versions of ant. They're both in the Maven repo, so I think it's at the Maven-level setup and not build.xml or something else.

Clue: The paths are different: org/apache/ant/ant/1.9.4/ant-1.9.4.jar vs. ant/ant/1.5/ant-1.5.jar!/org/apache/tools/ant/Project.class. I suspect that means they have different groupIds: ant was the old groupId from the time of log4j 1.2, but ot's org.apache.ant now. I changed some groupIds in the pom, but maybe I missed some. I'm not seeing these versions of ant specified in the pom.xml. But maybe 1.5 is the latest version in the old "ant" groupId, and the "org.apache.ant:ant" one is now up to 1.9.4.

[apache-log4j-1.2.15] $ grep -rn '<groupId>' . | grep ant
./pom.xml:245:            <groupId>org.apache.ant</groupId>
./pom.xml:250:            <groupId>ant-contrib</groupId>
./pom.xml:255:            <groupId>org.apache.ant</groupId>
[apache-log4j-1.2.15] $

Aha! The ant-contrib 1.0b3 package has a dependency on ant:ant 1.5.

Looks like development of ant-contrib stalled out in 2006, the 1.0b3 beta release was their last release. There's still some activity on their mailing list but it seems to consist mostly of "ant-contrib works fine as is" responses from the maintainer. So can't fix this by bumping to a newer ant-contrib release. Let's see if I can just remove the dependency.

I commented it out, the "multiple versions" warnings went away and nothing seemed to break; I'm getting to the same test failure as I was before.

[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] An Ant BuildException has occured: The following error occurred while executing this line:
/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/tests/build.xml:214: Test org.apache.log4j.PatternLayoutTestCase failed
around Ant part ...<ant dir="tests" target="runAll">... @ 4:36 in /Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/target/antrun/build-main.xml

On to the next test failure for now.

apjanke commented 2 years ago

PatternLayoutTestCase is erroring.

PatternLayout:
    [junit] Running org.apache.log4j.PatternLayoutTestCase
    [junit] Testsuite: org.apache.log4j.PatternLayoutTestCase
    [junit] Tests run: 14, Failures: 0, Errors: 2, Time elapsed: 0.126 sec
    [junit] Tests run: 14, Failures: 0, Errors: 2, Time elapsed: 0.126 sec
    [junit]
    [junit] Testcase: test1 took 0.046 sec
    [junit] Testcase: test2 took 0.014 sec
    [junit] Testcase: test3 took 0.008 sec
    [junit] Testcase: test4 took 0.004 sec
    [junit]     Caused an ERROR
    [junit] [10 Sep 2022 20:31:20,084 [main] TRACE rnLayoutTestCase - Message 0]
    [junit] org.apache.log4j.util.UnexpectedFormatException: [10 Sep 2022 20:31:20,084 [main] TRACE rnLayoutTestCase - Message 0]
    [junit]     at org.apache.log4j.util.ControlFilter.filter(ControlFilter.java:43)
    [junit]     at org.apache.log4j.util.Transformer.transform(Transformer.java:42)
    [junit]     at org.apache.log4j.PatternLayoutTestCase.test4(PatternLayoutTestCase.java:137)
    [junit]
    [junit] Testcase: test5 took 0.003 sec
    [junit]     Caused an ERROR
    [junit] [10 Sep 2022 20:31:20,089 [main] TRACE rnLayoutTestCase - Message 0]
    [junit] org.apache.log4j.util.UnexpectedFormatException: [10 Sep 2022 20:31:20,089 [main] TRACE rnLayoutTestCase - Message 0]
    [junit]     at org.apache.log4j.util.ControlFilter.filter(ControlFilter.java:43)
    [junit]     at org.apache.log4j.util.Transformer.transform(Transformer.java:42)
    [junit]     at org.apache.log4j.PatternLayoutTestCase.test5(PatternLayoutTestCase.java:151)
    [junit]
[...]
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] An Ant BuildException has occured: The following error occurred while executing this line:
/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/tests/build.xml:214: Test org.apache.log4j.PatternLayoutTestCase failed
around Ant part ...<ant dir="tests" target="runAll">... @ 4:36 in /Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/target/antrun/build-main.xml

That smells a lot like the earlier Y2010 failure. Maybe I don't have fresh class definitions?

[apache-log4j-1.2.15] $ rm -rf target/*
[apache-log4j-1.2.15] $ mvn2 clean &>/dev/null
[apache-log4j-1.2.15] $ find . -name '*.class' | head
./tests/classes/org/apache/log4j/MyPatternParser$UserDirPatternConverter.class
./tests/classes/org/apache/log4j/LoggerTestCase$CountingAppender.class
./tests/classes/org/apache/log4j/customLogger/XLogger$XFactory.class
./tests/classes/org/apache/log4j/customLogger/XLogger.class
./tests/classes/org/apache/log4j/customLogger/XLoggerTestCase.class
./tests/classes/org/apache/log4j/net/SMTPAppenderTest.class
./tests/classes/org/apache/log4j/net/SyslogAppenderTest$MishandledException.class
./tests/classes/org/apache/log4j/net/SocketServerTestCase.class
./tests/classes/org/apache/log4j/net/SMTPAppenderTest$MockTriggeringEventEvaluator.class
./tests/classes/org/apache/log4j/net/SyslogAppenderTest.class
[apache-log4j-1.2.15] $ ant clean &>/dev/null
[apache-log4j-1.2.15] $ find . -name '*.class' | head
./tests/classes/org/apache/log4j/MyPatternParser$UserDirPatternConverter.class
./tests/classes/org/apache/log4j/LoggerTestCase$CountingAppender.class
./tests/classes/org/apache/log4j/customLogger/XLogger$XFactory.class
./tests/classes/org/apache/log4j/customLogger/XLogger.class

Had to do a (cd tests && ant clean) to get rid of those.

And now all the tests pass.

That makes sense: those pattern strings in Filter.java in the main code are static final. Java static final basic values like that are (I think) picked up and inlined into client classes that reference them. So the tests classes would have still had them baked in even though I rebuilt the main module.

Would be best if the main ant clean target also cleaned the tests/ subdir.

apjanke commented 2 years ago

Okay, good. mvn2 compile and mvn2 test are succeeding now.

mvn2 site is failing.

[INFO] [antrun:run {execution: untag-site}]
[INFO] Executing tasks

main:
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] An Ant BuildException has occured: /Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/target/site/apidocs does not exist.
around Ant part ...<replaceregexp match="-- Generated by (.*) on .*--" replace="-- Generated by \1 --" flags="g">... @ 6:97 in /Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/target/antrun/build-main.xml

An erroronmissingdir="false" attribute cleared that up.

          <execution>
            <phase>site</phase>
            <id>untag-site</id>
            <configuration>
              <target>
                <taskdef name="replaceregexp" classname="org.apache.tools.ant.taskdefs.optional.ReplaceRegExp" />
                <replaceregexp file="target/site/source-repository.html" match="/tags/[^ ]*" replace="/trunk" flags="g" />
                <replaceregexp match="-- Generated by (.*) on .*--" replace="-- Generated by \1 --" flags="g">
                  <fileset dir="target/site/apidocs" includes="**/*.html" erroronmissingdir="false"/>

The mvn2 site target is succeeding now.

apjanke commented 2 years ago

Oof da. Big ol' error in the javadocs portion of mvn2 assembly:assembly.

[apache-log4j-1.2.15] $
[apache-log4j-1.2.15] $ mvn2 assembly:assembly | grep error
     [exec] Execute failed: java.io.IOException: Cannot run program "i586-mingw32msvc-windres" (in directory "/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/src/ntdll"): error=2, No such file or directory
    [junit] log4j: FB: The following error reported: Could not connect to remote log4j server at [localhost]. We are not retrying.
62 errors
/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/Appender.java:89: warning: no @param for errorHandler
  void setErrorHandler(ErrorHandler errorHandler);
/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/AsyncAppender.java:352: error: self-closing element not allowed
/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/AsyncAppender.java:353: error: self-closing element not allowed
/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/AsyncAppender.java:38: error: self-closing element not allowed
/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/AsyncAppender.java:39: error: self-closing element not allowed
/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/AsyncAppender.java:44: error: self-closing element not allowed
/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/AsyncAppender.java:45: error: self-closing element not allowed
/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/AsyncAppender.java:48: error: self-closing element not allowed
/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/DailyRollingFileAppender.java:125: error: no summary or caption for table
/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/Level.java:31: error: malformed HTML
/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/Level.java:34: error: block element not allowed within inline element <code>: p
/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/Level.java:31: error: element not closed: code
/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/Level.java:83: error: malformed HTML
/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/Level.java:83: error: element not closed: code
/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/LogManager.java:41: error: unexpected end tag: </a>
/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/PatternLayout.java:77: error: tag not allowed here: <th>
/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/PatternLayout.java:78: error: tag not allowed here: <th>
/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/PatternLayout.java:283: error: no summary or caption for table
/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/PatternLayout.java:319: error: tag not allowed here: <th>
/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/PatternLayout.java:320: error: tag not allowed here: <th>
/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/PatternLayout.java:321: error: tag not allowed here: <th>
/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/PatternLayout.java:322: error: tag not allowed here: <th>
/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/PatternLayout.java:323: error: tag not allowed here: <th>
/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/PatternLayout.java:367: error: no summary or caption for table
/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/PatternLayout.java:373: error: tag not allowed here: <p>
/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/PatternLayout.java:374: error: tag not allowed here: <p>
/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/PatternLayout.java:378: error: tag not allowed here: <p>
/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/WriterAppender.java:59: error: unknown tag: null
/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/WriterAppender.java:59: error: element not closed: code
/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/net/SocketAppender.java:40: error: tag not allowed here: <p>
/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/net/SocketHubAppender.java:59: error: tag not allowed here: <p>
/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/net/TelnetAppender.java:51: error: no summary or caption for table
/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/lf5/DefaultLF5Configurator.java:74: error: unknown tag: bold
/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/lf5/DefaultLF5Configurator.java:74: error: unknown tag: bold
/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/lf5/LF5Appender.java:62: error: unknown tag: bold
/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/lf5/LF5Appender.java:63: error: unknown tag: bold
/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/lf5/LF5Appender.java:78: error: element not closed: code
/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/lf5/LF5Appender.java:78: error: element not closed: code
/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/lf5/LF5Appender.java:74: error: element not closed: code
/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/lf5/LF5Appender.java:74: error: element not closed: code
/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/lf5/LF5Appender.java:73: error: element not closed: code
/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/lf5/LF5Appender.java:73: error: element not closed: code
/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/lf5/LogLevelFormatException.java:24: error: malformed HTML
/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/lf5/viewer/LF5SwingUtils.java:131: error: incorrect use of inline tag
/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/lf5/viewer/LogTableColumn.java:137: error: bad use of '>'
/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/lf5/viewer/LogTableColumn.java:137: error: element not closed: code
/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/xml/DOMConfigurator.java:74: error: bad use of '>'
/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/xml/DOMConfigurator.java:76: error: bad use of '>'
/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/xml/XMLLayout.java:47: error: invalid entity &data;
/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/jdbc/JDBCAppender.java:43: error: bad HTML entity
/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/or/RendererMap.java:136: error: no summary or caption for table
/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/helpers/Loader.java:74: error: tag not allowed here: <p>
/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/helpers/OptionConverter.java:369: error: unexpected end tag: </a>
/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/helpers/OptionConverter.java:369: error: unexpected end tag: </p>
/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/helpers/PatternParser.java:40: error: malformed HTML
/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/helpers/PatternParser.java:40: error: bad use of '>'
/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/helpers/PatternParser.java:40: error: unexpected end tag: </a>
/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/helpers/Transform.java:37: error: malformed HTML
/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/helpers/Transform.java:37: error: bad use of '>'
/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/helpers/Transform.java:37: error: bad HTML entity
/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/helpers/Transform.java:83: error: bad use of '>'
/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/helpers/Transform.java:87: error: malformed HTML
/Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/helpers/Transform.java:87: error: bad use of '>'
[apache-log4j-1.2.15] $

66 occurrences.

[apache-log4j-1.2.15] $ mvn2 assembly:assembly | grep error | wc -l
      66

I think I'll just fix them up to Java 8/HTML 4 conformance. It'll be a bit of drudgery, but they should all be easy fixes. And that'll probably work better in the long run than doing -Xdoclint:none or doing some automated transformation.

See: Stephen Colebourne's comments on the Java 8 javadoc HTML strictness.

apjanke commented 2 years ago

I modified the build.xml files to set includeantruntime="false" to support reproducible builds, and get rid of the warning about it being unset. The main build.xml file was explicitly setting it to true, but tests/build.xml omitted that attribute.

apjanke commented 2 years ago

Okay, now we've got an error creating the jar. Looks like it's an issue with naming inconsistencies from my changes to make it clear that this was the Janklab-munged version of the library.

[INFO] Building jar: /Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/target/log4j-1.2.15-janklab.1-javadoc.jar
[INFO] Preparing source:jar
[WARNING] Removing: jar from forked lifecycle, to prevent recursive invocation.
[INFO] No goals needed for project - skipping
[INFO] [source:jar {execution: default}]
[WARNING] NOT adding sources to artifacts with classifier as Maven only supports one classifier per artifact. Current artifact [net.janklab.opp.log4j:log4j:jar:tests:1.2.15-janklab.1] has a [tests] classifier.
[INFO] [assembly:assembly {execution: default-cli}]
[INFO] Reading assembly descriptor: src/assembly/bin.xml
[INFO] Adding site directory to assembly : /Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/target/site
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to create assembly: Error adding file to archive: /Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/target/janklab-opp-log4j-1.2.15-janklab.1.jar isn't a file.

Ah, yep, looks like I got over-eager here, and then decided to put the janklab indicator in the version number, not as a prefix to the JAR file name.

[apache-log4j-1.2.15] $ grep -r janklab-opp *
src/assembly/bin.xml:          <source>target/janklab-opp-log4j-${project.version}.jar</source>
[apache-log4j-1.2.15] $

Switched that back, and it fixed. Now I'm getting this:

INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to create assembly: Error adding file to archive: /Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/target/NTEventLogAppender.dll isn't a file.

NTEventLogAppender.dll is in the root dir of the project.

I tried adding this to the maven-antrun-executions element in pom.xml

          <!--   copy NTEventLogAppender.dll to target dir for packaging   -->
          <execution>
            <phase>prepare-package</phase>
            <id>ntdll-to-target</id>
            <configuration>
              <target name="ntdll-to-target">
                <echo message="ANTRUN: running ntdll-to-target"/>
                <copy todir="${basedir}/target">
                  <fileset dir="${basedir}" includes="NTEventLogAppender.dll"/>
                </copy>
              </target>
            </configuration>
          </execution>

But that seemed to have no effect. Between this project's complicated use of both Maven and ant, and my own mediocre skills with Maven, I can't figure out how to make "copy file A to location B" happen as part of this Maven build.

For now, I'm working around it with a manual copy to target/.

[apache-log4j-1.2.15] $ cp NTEventLogAppender.dll target
[apache-log4j-1.2.15] $ mvn2 assembly:assembly
[...]
[WARNING] Entry: apache-log4j-1.2.15-janklab.1/site/xref/org/apache/log4j/lf5/viewer/LogTableColumnFormatException.html longer than 100 characters.
[WARNING] Replacing pre-existing project main-artifact file: /Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/target/log4j-1.2.15-janklab.1.zip
with assembly file: /Users/janke/local/repos/SLF4M/src/opp/opp-munged/apache-log4j-1.2.15/target/log4j-1.2.15-janklab.1.tar.gz
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------

This is a tiresome enough process that I think I'm going to switch to giving log4j 1.2.17 a go; from its changelong, it seems to have a bunch of build-oriented fixes.

apjanke commented 2 years ago

WTF? I rebooted my machine, and now my maven-antrun target to copy NTEventLogAppender.dll to target/ seems to be working. ¯\(ツ)/¯ I'll take it, I guess.

apjanke commented 2 years ago

Got some warnings in the tar packaging step now, mostly about file name length > 100 characters.

[WARNING] NOT adding sources to artifacts with classifier as Maven only supports one classifier per artifact. Current artifact [net.janklab.opp.log4j:log4j:jar:tests:1.2.15-janklab.1] has a [tests] classifier.
[INFO] [assembly:assembly {execution: default-cli}]
[INFO] Reading assembly descriptor: src/assembly/bin.xml
[INFO] Adding site directory to assembly : /Users/janke/local/repos/slf4m/src/opp/opp-munged/apache-log4j-1.2.15/target/site
[INFO] Building zip: /Users/janke/local/repos/slf4m/src/opp/opp-munged/apache-log4j-1.2.15/target/log4j-1.2.15-janklab.1.zip
[WARNING] Configuration options: 'appendAssemblyId' is set to false, and 'classifier' is missing.
Instead of attaching the assembly file: /Users/janke/local/repos/slf4m/src/opp/opp-munged/apache-log4j-1.2.15/target/log4j-1.2.15-janklab.1.zip, it will become the file for main project artifact.
NOTE: If multiple descriptors or descriptor-formats are provided for this project, the value of this file will be non-deterministic!
[INFO] Building tar : /Users/janke/local/repos/slf4m/src/opp/opp-munged/apache-log4j-1.2.15/target/log4j-1.2.15-janklab.1.tar.gz
[WARNING] Entry: apache-log4j-1.2.15-janklab.1/examples/lf5/InitUsingDefaultConfigurator/InitUsingDefaultConfigurator.java longer than 100 characters.
[WARNING] Resulting tar file can only be processed successfully by GNU compatible tar commands
[WARNING] Entry: apache-log4j-1.2.15-janklab.1/examples/lf5/InitUsingMultipleAppenders/InitUsingMultipleAppenders.java longer than 100 characters.
[WARNING] Entry: apache-log4j-1.2.15-janklab.1/examples/lf5/InitUsingXMLPropertiesFile/InitUsingXMLPropertiesFile.java longer than 100 characters.
[WARNING] Entry: apache-log4j-1.2.15-janklab.1/src/performance/java/org/apache/log4j/performance/history/FALKNIS.logging longer than 100 characters.
[WARNING] Entry: apache-log4j-1.2.15-janklab.1/src/performance/java/org/apache/log4j/performance/history/TORINO.logging longer than 100 characters.
[WARNING] Entry: apache-log4j-1.2.15-janklab.1/src/performance/java/org/apache/log4j/performance/history/NAPOLI.logging longer than 100 characters.
[WARNING] Entry: apache-log4j-1.2.15-janklab.1/src/main/resources/org/apache/log4j/lf5/config/defaultconfig.properties longer than 100 characters.
[WARNING] Entry: apache-log4j-1.2.15-janklab.1/src/main/resources/org/apache/log4j/lf5/viewer/images/channelexplorer_satellite.gif longer than 100 characters.
[WARNING] Entry: apache-log4j-1.2.15-janklab.1/src/main/resources/org/apache/log4j/lf5/viewer/images/channelexplorer_new.gif longer than 100 characters.
[WARNING] Entry: apache-log4j-1.2.15-janklab.1/src/main/resources/org/apache/log4j/lf5/viewer/images/lf5_small_icon.gif longer than 100 characters.
[WARNING] Entry: apache-log4j-1.2.15-janklab.1/src/main/java/org/apache/log4j/varia/ExternallyRolledFileAppender.java longer than 100 characters.
[WARNING] Entry: apache-log4j-1.2.15-janklab.1/src/main/java/org/apache/log4j/varia/ReloadingPropertyConfigurator.java longer than 100 characters.
[WARNING] Entry: apache-log4j-1.2.15-janklab.1/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryAbstractCellEditor.java longer than 100 c

They're hitting 115 characters, and my suffics to the project name is less than 16 characters, so I don't think that's what's pushing them over the limit here.

>> f = 'apache-log4j-1.2.15-janklab.1/site/xref/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryAbstractCellEditor.html';
>> numel(f)
ans =
   116
>> numel('-janklab.1')
ans =
    10
>> 

I suspect this behavior was present in the original log4j, and people lived with it because GNU tar is so common. ("Resulting tar file can only be processed successfully by GNU compatible tar commands" in the warnings.) Or maybe that message is misleading, and other modern tars can handle it, and they are "GNU compatible". And I don't actually need the .tar.gz distribution to be usable; all I need here is the JARs to bundle with SLF4M. So I'm not going to worry about this right now.

apjanke commented 2 years ago

A whole lot of doclint warnings in the apidoc building step. I don't like that warning spam in the build step, but it's really of no consequence, so I'm not going to worry about this now. Going to focus on building a munged log4j 1.2.17 instead.


[WARNING] /Users/janke/local/repos/slf4m/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/Category.java:521: warning: no @param for name
[WARNING] Category getInstance(String name) {
[WARNING] ^
[WARNING] /Users/janke/local/repos/slf4m/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/Category.java:521: warning: no @return
[WARNING] Category getInstance(String name) {
[WARNING] ^
[WARNING] /Users/janke/local/repos/slf4m/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/Category.java:530: warning: no @param for clazz
[WARNING] Category getInstance(Class clazz) {
[WARNING] ^
[WARNING] /Users/janke/local/repos/slf4m/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/Category.java:530: warning: no @return
[WARNING] Category getInstance(Class clazz) {
[WARNING] ^
[WARNING] /Users/janke/local/repos/slf4m/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/Category.java:539: warning: no @return
[WARNING] String getName() {
[WARNING] ^
[WARNING] /Users/janke/local/repos/slf4m/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/Category.java:554: warning: no @return
[WARNING] Category getParent() {
[WARNING] ^
[WARNING] /Users/janke/local/repos/slf4m/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/Category.java:575: warning: no @return
[WARNING] Level getPriority() {
[WARNING] ^
[WARNING] /Users/janke/local/repos/slf4m/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/Category.java:586: warning: no @return
[WARNING] Category getRoot() {
[WARNING] ^
[WARNING] /Users/janke/local/repos/slf4m/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/Category.java:602: warning: no @return
[WARNING] ResourceBundle getResourceBundle() {
[WARNING] ^
[WARNING] /Users/janke/local/repos/slf4m/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/Category.java:620: warning: no @param for key
[WARNING] String getResourceBundleString(String key) {
[WARNING] ^
[WARNING] /Users/janke/local/repos/slf4m/src/opp/opp-munged/apache-log4j-1.2.15/src/main/java/org/apache/log4j/Category.java:620: warning: no @return
apjanke commented 2 years ago

Something to think about: When doing big experimental WIP like this, maybe I should do it on a separate fork/clone of the main repo, instead of just a branch on the primary repo. I'm afraid that all these upstream library files I'm pulling in are going to end up inflating the main repo size even if I do some rebasing and branch deletion before merging to master. In git, nothing ever really goes away once it's committed, right? These git push operations are taking a long time. This one has been running for a couple minutes, stuck at the "Total 2699" bit.

$ git push --force
Enumerating objects: 2702, done.
Counting objects: 100% (2702/2702), done.
Delta compression using up to 20 threads
Compressing objects: 100% (2386/2386), done.
Writing objects: 100% (2699/2699), 8.11 MiB | 1.35 MiB/s, done.
Total 2699 (delta 1206), reused 1 (delta 0), pack-reused 0

Or maybe this is unrelated, and just another one of those Linux development tool and networking configuration things I need to sort out.

Maybe my git-credential-manager-core (now called just "git-credential-manager" in branding terms, I think?) is out of date? That's not supplied with Git or as part of MacPorts. I'm on 2.0.567, and it's up to 2.0.785 now.

[gcm-core] $ pwd
/usr/local/share/gcm-core
[gcm-core] $ ./git-credential-manager-core --version
2.0.567+3047faf390
[gcm-core] $

I can't tell how I got this binary installed. I'm running MacPorts and not Homebrew on this Mac, because I'm still on macOS 10.14. I guess I just downloaded and ran the GitCredentialmanager .pkg installer at some point in the past? I'll try upgrading to the latest using that installation method.

I downloaded gcm-osx-x64-2.0.785.pkg from the GitCredentialManager 2.0.785 release on GitHub and ran it. After that, I had a new git-credential-manager-core binary in /usr/local/share/gcm-core.

[gcm-core] $ ./git-credential-manager-core --version
2.0.785+6074e4e3d3

Tried doing a git push again. And this time it ran fine. There's a new WIP/munged-java-logging-libs-for-R2021a branch and it only took a few seconds to do the uploade.

apjanke commented 2 years ago

The 1.2.17 build modernization is going pretty smoothly. Mostly repeating the stuff I did for 1.2.15, and I'm able to skip some stuff too, because 1.2.17 is years newer, and runs against newer Maven plugins and whatnot.

Now I'm hitting a test failure in XMLLayoutTestCase:

ErrorHandler:
    [junit] Running org.apache.log4j.varia.ErrorHandlerTestCase
    [junit] Testsuite: org.apache.log4j.varia.ErrorHandlerTestCase
    [junit] Tests run: 2, Failures: 0, Errors: 1, Time elapsed: 0.079 sec
    [junit] Tests run: 2, Failures: 0, Errors: 1, Time elapsed: 0.079 sec
    [junit] ------------- Standard Output ---------------
    [junit] log4j: Parsing for [root] with value=[DEBUG, PRIMARY].
    [junit] log4j: Level token is [DEBUG].
    [junit] log4j: Category root set to DEBUG
    [junit] log4j: Parsing appender named "PRIMARY".
    [junit] log4j: Parsing layout options for "PRIMARY".
    [junit] log4j: Setting property [conversionPattern] to [%-5p %c{2} - %m%n].
    [junit] log4j: End of parsing for "PRIMARY".
    [junit] log4j: Parsing errorhandler options for "PRIMARY".
    [junit] log4j: End of errorhandler parsing for "PRIMARY".
    [junit] log4j: Setting property [append] to [false].
    [junit] log4j: Setting property [file] to [/xyz/:x.log].
    [junit] log4j: setFile called: /xyz/:x.log, false
    [junit] log4j: FB: The following error reported: setFile(null,false) call failed.
    [junit] java.io.FileNotFoundException: /xyz/:x.log (No such file or directory)
    [junit]     at java.io.FileOutputStream.open0(Native Method)
    [junit]     at java.io.FileOutputStream.open(FileOutputStream.java:270)
    [junit]     at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
    [junit]     at java.io.FileOutputStream.<init>(FileOutputStream.java:133)
    [junit]     at org.apache.log4j.FileAppender.setFile(FileAppender.java:294)
    [junit]     at org.apache.log4j.FileAppender.activateOptions(FileAppender.java:165)
    [junit]     at org.apache.log4j.config.PropertySetter.activate(PropertySetter.java:307)
    [junit]     at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:172)
    [junit]     at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:104)
    [junit]     at org.apache.log4j.PropertyConfigurator.parseAppender(PropertyConfigurator.java:842)
    [junit]     at org.apache.log4j.PropertyConfigurator.parseCategory(PropertyConfigurator.java:768)
    [junit]     at org.apache.log4j.PropertyConfigurator.configureRootCategory(PropertyConfigurator.java:648)
    [junit]     at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:514)
    [junit]     at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:395)
    [junit]     at org.apache.log4j.PropertyConfigurator.configure(PropertyConfigurator.java:403)
    [junit]     at org.apache.log4j.varia.ErrorHandlerTestCase.test2(ErrorHandlerTestCase.java:86)
    [junit]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    [junit]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    [junit]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    [junit]     at java.lang.reflect.Method.invoke(Method.java:498)
    [junit]     at junit.framework.TestCase.runTest(TestCase.java:154)
    [junit]     at junit.framework.TestCase.runBare(TestCase.java:127)
    [junit]     at junit.framework.TestResult$1.protect(TestResult.java:106)
    [junit]     at junit.framework.TestResult.runProtected(TestResult.java:124)
    [junit]     at junit.framework.TestResult.run(TestResult.java:109)
    [junit]     at junit.framework.TestCase.run(TestCase.java:118)
    [junit]     at junit.framework.TestSuite.runTest(TestSuite.java:208)
    [junit]     at junit.framework.TestSuite.run(TestSuite.java:203)
    [junit]     at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:420)
    [junit]     at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:911)
    [junit]     at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:768)
    [junit] log4j: FB: INITIATING FALLBACK PROCEDURE.
    [junit] log4j: Parsed "PRIMARY" options.
    [junit] log4j: Finished configuring.
    [junit] log4j: System property is :null
    [junit] log4j: Standard DocumentBuilderFactory search succeded.
    [junit] log4j: DocumentBuilderFactory is: com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl
    [junit] log4j: debug attribute= "true".
    [junit] log4j: reset attribute= "false".
    [junit] log4j: Threshold ="null".
    [junit] log4j: Level value for root is  [debug].
    [junit] log4j: root level set to DEBUG
    [junit] log4j: Class name: [org.apache.log4j.FileAppender]
    [junit] log4j: FB: Setting primary appender to [PRIMARY].
    [junit] log4j: FB: Adding logger [root].
    [junit] log4j: Class name: [org.apache.log4j.FileAppender]
    [junit] log4j: Setting property [file] to [output/temp].
    [junit] log4j: Setting property [append] to [false].
    [junit] log4j: Parsing layout of class: "org.apache.log4j.PatternLayout"
    [junit] log4j: Setting property [conversionPattern] to [FALLBACK - %c - %m%n].
    [junit] log4j: setFile called: output/temp, false
    [junit] log4j: setFile ended
    [junit] log4j: FB: Setting backup appender to [FALLBACK].
    [junit] log4j: Setting property [file] to [].
    [junit] log4j: Setting property [append] to [false].
    [junit] log4j: Parsing layout of class: "org.apache.log4j.PatternLayout"
    [junit] log4j: Setting property [conversionPattern] to [%-5p %c{2} - %m%n].
    [junit] log4j: setFile called: , false
    [junit] log4j: FB: The following error reported: setFile(null,false) call failed.
    [junit] java.io.FileNotFoundException:  (No such file or directory)
    [junit]     at java.io.FileOutputStream.open0(Native Method)
    [junit]     at java.io.FileOutputStream.open(FileOutputStream.java:270)
    [junit]     at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
    [junit]     at java.io.FileOutputStream.<init>(FileOutputStream.java:133)
    [junit]     at org.apache.log4j.FileAppender.setFile(FileAppender.java:294)
    [junit]     at org.apache.log4j.FileAppender.activateOptions(FileAppender.java:165)
    [junit]     at org.apache.log4j.config.PropertySetter.activate(PropertySetter.java:307)
    [junit]     at org.apache.log4j.xml.DOMConfigurator.parseAppender(DOMConfigurator.java:294)
    [junit]     at org.apache.log4j.xml.DOMConfigurator.findAppenderByName(DOMConfigurator.java:175)
    [junit]     at org.apache.log4j.xml.DOMConfigurator.findAppenderByReference(DOMConfigurator.java:190)
    [junit]     at org.apache.log4j.xml.DOMConfigurator.parseChildrenOfLoggerElement(DOMConfigurator.java:522)
    [junit]     at org.apache.log4j.xml.DOMConfigurator.parseRoot(DOMConfigurator.java:491)
    [junit]     at org.apache.log4j.xml.DOMConfigurator.parse(DOMConfigurator.java:1005)
    [junit]     at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:871)
    [junit]     at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:754)
    [junit]     at org.apache.log4j.xml.DOMConfigurator.configure(DOMConfigurator.java:895)
    [junit]     at org.apache.log4j.varia.ErrorHandlerTestCase.test1(ErrorHandlerTestCase.java:66)
    [junit]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    [junit]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    [junit]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    [junit]     at java.lang.reflect.Method.invoke(Method.java:498)
    [junit]     at junit.framework.TestCase.runTest(TestCase.java:154)
    [junit]     at junit.framework.TestCase.runBare(TestCase.java:127)
    [junit]     at junit.framework.TestResult$1.protect(TestResult.java:106)
    [junit]     at junit.framework.TestResult.runProtected(TestResult.java:124)
    [junit]     at junit.framework.TestResult.run(TestResult.java:109)
    [junit]     at junit.framework.TestCase.run(TestCase.java:118)
    [junit]     at junit.framework.TestSuite.runTest(TestSuite.java:208)
    [junit]     at junit.framework.TestSuite.run(TestSuite.java:203)
    [junit]     at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:420)
    [junit]     at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:911)
    [junit]     at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:768)
    [junit] log4j: FB: INITIATING FALLBACK PROCEDURE.
    [junit] log4j: FB: Searching for [PRIMARY] in logger [root].
    [junit] log4j: FB: Replacing [PRIMARY] by [FALLBACK] in logger [root].
    [junit] log4j: FB: Adding appender [FALLBACK] to logger root
    [junit] log4j: Adding appender named [PRIMARY] to category [root].
    [junit] ------------- ---------------- ---------------
    [junit]
    [junit] Testcase: test2 took 0.037 sec
    [junit]     Caused an ERROR
    [junit] [<log4j:event logger="org.apache.log4j.xml.XMLLayoutTestCase" timestamp="1662885316076" level="DEBUG" thread="main">]
    [junit] org.apache.log4j.util.UnexpectedFormatException: [<log4j:event logger="org.apache.log4j.xml.XMLLayoutTestCase" timestamp="1662885316076" level="DEBUG" thread="main">]
    [junit]     at org.apache.log4j.util.ControlFilter.filter(ControlFilter.java:43)
    [junit]     at org.apache.log4j.util.Transformer.transform(Transformer.java:41)
    [junit]     at org.apache.log4j.varia.ErrorHandlerTestCase.test2(ErrorHandlerTestCase.java:96)
    [junit]
    [junit] Testcase: test1 took 0.038 sec
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  01:17 min
[INFO] Finished at: 2022-09-11T04:35:39-04:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.8:run (runAll) on project log4j: An Ant BuildException has occured: The following error occurred while executing this line:
# Custom gitignore for Janklab-munged log4j 1.2.15 repo
[ERROR] /Users/janke/local/repos/slf4m/src/opp/opp-munged/apache-log4j-1.2.17/tests/build.xml:367: Test org.apache.log4j.varia.ErrorHandlerTestCase failed
[ERROR] around Ant part ...<ant dir="tests" target="runAll">... @ 4:36 in /Users/janke/local/repos/slf4m/src/opp/opp-munged/apache-log4j-1.2.17/target/antrun/build-main.xml
apjanke commented 2 years ago

I've got log4j 1.2.17 building now, and am cleaning up javadoc doclint warnings. I've fixed a bunch of them, but they just keep coming.

Generating /Users/janke/local/repos/slf4m/src/opp/opp-munged/apache-log4j-1.2.17/target/site/apidocs/help-doc.html...
100 warnings
[WARNING] Javadoc Warnings
[WARNING] /Users/janke/local/repos/slf4m/src/opp/opp-munged/apache-log4j-1.2.17/src/main/java/org/apache/log4j/WriterAppender.java:412: warning: no @param for event
[WARNING] protected boolean shouldFlush(final LoggingEvent event) {
[WARNING] ^
[WARNING] /Users/janke/local/repos/slf4m/src/opp/opp-munged/apache-log4j-1.2.17/src/main/java/org/apache/log4j/FileAppender.java:142: warning: attribute obsolete, use CSS instead: color
[WARNING] <p><font color="#DD0044"><b>Note that the special values
[WARNING] ^
[WARNING] /Users/janke/local/repos/slf4m/src/opp/opp-munged/apache-log4j-1.2.17/src/main/java/org/apache/log4j/FileAppender.java:310: warning: no @throws for java.io.IOException
[WARNING] void setFile(String fileName, boolean append, boolean bufferedIO, int bufferSize)
[WARNING] ^
[...]

Oh no: Is the warning output limited to 100 warnings here, and there are actually a lot more of them hiding in the code? Rats.

apjanke commented 2 years ago

If you get this mvn build error about a missing Sun tools.jar file:

[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.

Missing:
----------
1) sun.jdk:tools:jar:1.8.0

  Try downloading the file manually from the project website.

That might just mean that your $JAVA_HOME isn't set correctly. The tools.jar is taken from the "system" location. $JAVA_HOME is not set up on macOS by default.

This also means that this mechanism might be picking up the wrong version of the tools.jar file, if your $JAVA_HOME isn't pointed at a Java 8 JDK. That should be fixed.

Do this on macOS in the shell where you're doing your mvn work to get it set right:

$ export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)