jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Konrad Windszus (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (JCRVLT-326) Embedded files Map stored in project properties breaks Jenkins+Artifactory integration
Date Wed, 13 Feb 2019 16:26:00 GMT

    [ https://issues.apache.org/jira/browse/JCRVLT-326?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16767362#comment-16767362

Konrad Windszus commented on JCRVLT-326:

Actually I think that we should get rid of using {{MavenProject.getProperties()}} at all and
instead rely on {{AbstractMojo.getPluginContext()}} (https://maven.apache.org/ref/3.1.0/maven-plugin-api/apidocs/org/apache/maven/plugin/ContextEnabled.html#getPluginContext()).
That allows to place a map with arbitrary value types.

> 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
>            Priority: Major
>              Labels: newbie
> 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

View raw message