jmxterm icon indicating copy to clipboard operation
jmxterm copied to clipboard

RPM plugin fails to run due to older maven-site-plugin version

Open tallpsmith opened this issue 6 years ago • 2 comments

Out of the box checkout, the rpm:rpm plugin doesn't work on:

Maven: 3.5.4
Java: 1.8.0_172

The parent pom specifies a maven-site-plugin version of 3.4, however I run into problems under the above config that seems to suggest the older version of the site plugin no longer functional in modern JVMs:

see: https://stackoverflow.com/questions/51091539/maven-site-plugins-3-3-java-lang-classnotfoundexception-org-apache-maven-doxia

I tried hacking a copy of the parent plugin to set the site plugin to 3.7.1 but running into further incompatibilities:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-site-plugin:3.7.1:site (default-site) on project jmxterm: SiteToolException: Error parsing site descriptor: TEXT must be immediately followed by END_TAG and not START_TAG (position: START_TAG seen ..."\n                src="http://www.google-analytics.com/urchin.js">... @16:65) -> [Help 1]

Looks like a URL somewhere in one of the POM descriptors is not returning something expected ?

tallpsmith avatar Aug 22 '18 05:08 tallpsmith

Hi,

I ran into the same problem quite some time later. I am using maven 3.5.3 with the maven-site-plugin:3.8.2. After some searching I found the following link:

https://maven.apache.org/plugins/maven-site-plugin/examples/sitedescriptor.html

It explains: 'Notice: since Maven Site Plugin version 3.5, if XHTML content is used, it has to be escaped, for example through CDATA XML notation. Previously, XML content didn't need such escaping.'

Example:

<head> <![CDATA[<script src="http://www.google-analytics.com/urchin.js" type="text/javascript" />]]> </head>

To fix my problem locally I changed the head section of the src/site/site.xml to:

<head> <![CDATA[ <script type="text/javascript" src="http://www.google-analytics.com/urchin.js"> </script> <script type="text/javascript"> _uacct = "UA-76203-1"; urchinTracker(); </script> ]]> </head>

I have not tested if the scripts are loaded correctly but at least mvn site and mvn rpm:rpm now work successfully.

carsten0x51h avatar Oct 07 '20 10:10 carsten0x51h

Another note (which maybe does not belong here but might still be helpful). After building and installing the RPM I tried to execute jmxterm and got the following error:

Error: A JNI error has occurred, please check your installation and try again Exception in thread "main" java.lang.NoClassDefFoundError: net/sourceforge/cobertura/coveragedata/LightClassmapListener at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:2701) at java.lang.Class.privateGetMethodRecursive(Class.java:3048) at java.lang.Class.getMethod0(Class.java:3018) at java.lang.Class.getMethod(Class.java:1784) at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544) at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526) Caused by: java.lang.ClassNotFoundException: net.sourceforge.cobertura.coveragedata.LightClassmapListener at java.net.URLClassLoader.findClass(URLClassLoader.java:382) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 7 more

It looks like the cobertura coverage code somehow made it into the final executable (I guess that should not be the case in a released version?) and a required file from covertura could not be found. Luckily I found an easy way to disable cobertura:

mvn clean package site rpm:rpm -Dcobertura.skip

This way the dependency is no longer required and I can execute jmxterm as expected.

carsten0x51h avatar Oct 07 '20 12:10 carsten0x51h