Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

log4j 1.2.15: "assembly descriptor filesystem-root relative reference" warning under maven-assembly-plugin 2.6 #22

Open
apjanke opened this issue Sep 15, 2022 · 5 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@apjanke
Copy link
Member

apjanke commented Sep 15, 2022

When I bumped maven-assembly-plugin from 2.2.2 to 2.6, I started getting this warning.

[INFO] --- maven-assembly-plugin:2.6:assembly (default-cli) @ log4j ---
[INFO] Reading assembly descriptor: src/assembly/bin.xml
[INFO] Adding site directory to assembly : /Users/janke/repos/slf4m-jankalog/src/opp/opp-munged/log4j-1.2.15/target/site
[WARNING] The assembly descriptor contains a filesystem-root relative reference, which is not cross platform compatible /site
[INFO] Building zip: /Users/janke/repos/slf4m-jankalog/src/opp/opp-munged/log4j-1.2.15/target/log4j-1.2.15-janklab.1-preview.zip
[WARNING] The assembly descriptor contains a filesystem-root relative reference, which is not cross platform compatible /site
[INFO] Building tar: /Users/janke/repos/slf4m-jankalog/src/opp/opp-munged/log4j-1.2.15/target/log4j-1.2.15-janklab.1-preview.tar.gz
@apjanke apjanke self-assigned this Sep 15, 2022
@apjanke apjanke added the bug Something isn't working label Sep 15, 2022
@apjanke apjanke added this to the SLF4M 1.4.0 milestone Sep 15, 2022
@apjanke apjanke changed the title log4j 1.2.15: "filesystem-root relative reference" warning under maven-assembly-plugin 2.6 log4j 1.2.15: "assembly descriptor filesystem-root relative reference" warning under maven-assembly-plugin 2.6 Sep 15, 2022
@apjanke
Copy link
Member Author

apjanke commented Sep 15, 2022

Tried adding a <outputDirectory/> to maven-assembly-plugin's <configuration> as described in this Stack Overflow answer, but that had no apparent effect, and the warnings kept coming.

Wonder if that trailing "/site" in the warning message is a clue? There's no actual /site reference in the pom.xml assembly config section, or in the src/assembly/bin.xml file it references. But that bin.xml does have a <includeSiteDirectory>true</includeSiteDirectory> item.

Yeah: if I remove that includeSiteDirectory, then the warnings go away. But I don't know what effect that has on the resulting assembly tarballs. Gotta investigate that.

[INFO] <<< maven-assembly-plugin:2.6:assembly (default-cli) < package @ log4j <<<
[INFO]
[INFO]
[INFO] --- maven-assembly-plugin:2.6:assembly (default-cli) @ log4j ---
[INFO] Reading assembly descriptor: src/assembly/bin.xml
[INFO] Building zip: /Users/janke/repos/slf4m-jankalog/src/opp/opp-munged/log4j-1.2.15/target/log4j-1.2.15-janklab.1-preview.zip
[INFO] Building tar: /Users/janke/repos/slf4m-jankalog/src/opp/opp-munged/log4j-1.2.15/target/log4j-1.2.15-janklab.1-preview.tar.gz
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS

Here's opengeospatial/ets-ogcapi-features10 having what looks like the exact same issue. They solved it by removing <includeSiteDirectory>, and replacing it with regular file references:

  <fileSets>
    [...]
    <fileSet>
      <directory>${project.build.directory}/site</directory>
      <outputDirectory>site</outputDirectory>
      <filtered>true</filtered>
    </fileSet>

@apjanke
Copy link
Member Author

apjanke commented Sep 15, 2022

I commented on that opengeospatial bug; here's what I said.


I found some reference doco for the maven-site-assembly plugin:

None of those have a <siteDirectory> element/parameter that I can see.

But if I look at the Javadoc for some classes in the assembly 3.4.2 plugin's implmentation, there are Java getter/setters for a siteDirectory JavaBeans property in some of its classes.

Those class's other properties look like the correspond to the elements in the POM <configuration> section for maven-assembly-plugin. So I bet that's where it goes. And IntelliJ's POM XML Intellisense feature seems to agree:

image

I don't know why siteDirectory doesn't show up in the more user-facing documentation above. Is this actually an internal-use method for the plugin itself, and its omission was intentional? Or is it a documentation bug in whatever's generating those web pages? (And why are the "mojo" documentation pages for the <configuration> sections of Maven plugins so hard to find? They don't seem to be linked anywhere in the navigation stuff in the plugins' main pages like this maven-compiler-plugin page; I either have to get lucky with a link in the body text of the plugin page, or google for "maven-<pluginname>-plugin mojo".)

I re-enabled <includeSiteDirectory>true</includeSiteDirectory>, and stuck this in the assembly POM <configuration> section for my project:

        <configuration>
          <siteDirectory>/some/nonexistent/bogus/path</siteDirectory>

and it started kicking out this error:

[INFO] --- maven-assembly-plugin:2.6:assembly (default-cli) @ log4j ---
[INFO] Reading assembly descriptor: src/assembly/bin.xml
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  11.707 s
[INFO] Finished at: 2022-09-15T01:05:11-04:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.6:assembly (default-cli) on project log4j: site did not exist in the target directory - please run site:site before creating the assembly: Mojo configuration is invalid: site did not exist in the target directory - please run site:site before creating the assembly -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

So I think that's the right place for <siteDirectory>; but I dunno how to use it here.

apjanke added a commit that referenced this issue Sep 15, 2022
apjanke added a commit that referenced this issue Sep 15, 2022
@apjanke
Copy link
Member Author

apjanke commented Sep 15, 2022

Sounds like with newer maven-assembly-plugin versions, I should be using the assembly:single target instead of assembly:assembly anyway?

[log4j-1.2.15] $ mvn clean >/dev/null
[log4j-1.2.15] $ mvn assembly:single
[INFO] Scanning for projects...
[INFO]
[INFO] -------------------< net.janklab.shmorg.log4j:log4j >-------------------
[INFO] Building Janklab-Munged Apache Log4j 1.2.15-janklab.1-preview
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-assembly-plugin:2.6:single (default-cli) @ log4j ---
[INFO] Reading assembly descriptor: src/assembly/bin.xml
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.534 s
[INFO] Finished at: 2022-09-15T01:19:05-04:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.6:single (default-cli) on project log4j: Failed to create assembly: Error adding file to archive: /Users/janke/repos/slf4m-jankalog/src/opp/opp-munged/log4j-1.2.15/target/log4j-1.2.15-janklab.1-preview.jar -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[log4j-1.2.15] $

Same error if I do mvn compile site assembly:single. Maybe I'm missing some prereequisite mvn build step here?

@apjanke
Copy link
Member Author

apjanke commented Sep 15, 2022

Aha: I was missing mvn package.

[log4j-1.2.15] $ mvn clean >/dev/null; cp NTEventLogAppender.dll target
[log4j-1.2.15] $ mvn package >/dev/null
     [exec] Execute failed: java.io.IOException: Cannot run program "i586-mingw32msvc-windres" (in directory "/Users/janke/repos/slf4m-jankalog/src/opp/opp-munged/log4j-1.2.15/src/ntdll"): error=2, No such file or directory
[log4j-1.2.15] $ mvn assembly:single
[INFO] Scanning for projects...
[INFO]
[INFO] -------------------< net.janklab.shmorg.log4j:log4j >-------------------
[INFO] Building Janklab-Munged Apache Log4j 1.2.15-janklab.1-preview
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-assembly-plugin:2.6:single (default-cli) @ log4j ---
[INFO] Reading assembly descriptor: src/assembly/bin.xml
[INFO] Building zip: /Users/janke/repos/slf4m-jankalog/src/opp/opp-munged/log4j-1.2.15/target/log4j-1.2.15-janklab.1-preview.zip
[INFO] Building tar: /Users/janke/repos/slf4m-jankalog/src/opp/opp-munged/log4j-1.2.15/target/log4j-1.2.15-janklab.1-preview.tar.gz
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.124 s
[INFO] Finished at: 2022-09-15T01:21:36-04:00
[INFO] ------------------------------------------------------------------------
[log4j-1.2.15] $

I wonder why that's not a defined dependency of assembly:single and run automatically?

@apjanke
Copy link
Member Author

apjanke commented Sep 15, 2022

Okay, so I think this is the command I should be using to do a full clean build and package-dist under Maven 3:

mvn clean; cp NTEventLogAppender.dll target; mvn compile site package assembly:single

Runs without error now. (Usually. I get intermittent errors complaining about missing JARs and stuff. Dunno what's up with that.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant