Search code examples
arraysxmlmavenpropertiesparam

How to externalise multiple parameter in a properties file while using maven?


I have pom.xml and custom mojo plugin which requires String [] parameter. At the moment I am using pom.xml to set the values but now I want it that it should pickup from properties file.

I am using maven properties plugin to read simple properties but I am not able to do so for String [], I tried putting in ; separate format but my build does not work successfully.

my pom.xml file at the moment has value set as follows (this is working)

<configuration>
 <wcsServerId>${deployWcsServerId}</wcsServerId>
  <deployments>
   <param>@SITE:*</param>                   
   <param>AttrTypes</param>
   <param>ContentAttribute</param>
  </deployments>
</configuration>

I have tried putting following in my properties file and managed to read it using maven properties plugin but build is not running successfully.

my properties file value

global.flags=@SITE:;AttrTypes:;ContentAttribute:;ContentFilter:

I was then calling it as follows, at runtime values are getting picked up but somehow builds get fails.

<configuration>
 <wcsServerId>${deployWcsServerId}</wcsServerId>
  <deployments>    
   <param>${global.flags}</param>
  </deployments>
</configuration>

Any suggestion or maven plugin recommendation to use for multiple param?


Solution

  • I managed to resolve this myself....

    the oracle csdt plugin requires parameters to be passed in specific order.

    The CSDT will process items in the order it finds them.

    This means that it could try to import an asset before its dependency even though the dependency exists later in the batch.

    The way to avoid these issues is to make sure that you import assets in order.

    The order is the same as you would use if you were creating a site e.g. @SITE, @ATTRIBUTE, @PARENTDEF etc.