Kyle Giovannetti created JCRVLT-326:
---------------------------------------
Summary: Embedded files Map stored in project properties breaks
Jenkins+Artifactory integration
Key: JCRVLT-326
URL: https://issues.apache.org/jira/browse/JCRVLT-326
Project: Jackrabbit FileVault
Issue Type: Bug
Components: package maven plugin
Affects Versions: package-maven-plugin-1.0.3
Reporter: Kyle Giovannetti
The issue is caused by placing a Map object, containing the embedded files, as
a value in the project properties. This is done in
AbstractPackageMojo#setEmbeddedFilesMap(Map<String, File> embeddedFiles)
The project properties is an object of type java.util.Properties.
The Properties class extends java.util.Hashtable, and by using the
Hashtable#get(Object key) and Hashtable#put(Object key, Object value) methods,
any object may be stored in the Properties object. However, it is not
recommended to store any key or value other than a String.
[Properties#getProperty(String
key)|https://docs.oracle.com/javase/7/docs/api/java/util/Properties.html#getProperty(java.lang.String)]
and [Properties#setProperty(String key, String
value)|https://docs.oracle.com/javase/7/docs/api/java/util/Properties.html#setProperty(java.lang.String,%20java.lang.String)]
should be used instead.
The issue is discussed here:
[https://stackoverflow.com/questions/30381563/putting-objects-into-java-util-properties/30381798#30381798]
And the API documentation for
[java.util.Properties|https://docs.oracle.com/javase/7/docs/api/java/util/Properties.html]
states that "Each key and its corresponding value in the property list is a
string.".
Many other projects will assume that the properties contain only String
key/value pairs, and will cause a ClassCastException if the value cannot be
cast to a String. This is the case when building a package using
filevault-package-maven-plugin in Jenkins while also using the [Jenkins
Artifactory
Plugin|https://www.jfrog.com/confluence/display/RTF/Jenkins+Artifactory+Plug-in],
which attempts to capture the build properties and store them in an
Artifactory server.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)