3

Is it possible to pass the ruleParameters argument when using the jQAssistant-Maven-Plugin from command line?

I tried to call the analyze goal of the plugin like so:

 mvn com.buschmais.jqassistant:jqassistant-maven-plugin:1.8.0:analyze  -Djqassistant.ruleParameters=KEY.VALUE

but get the error

Caused by: org.codehaus.plexus.component.configurator.ComponentConfigurationException: 
Cannot assign configuration entry 'ruleParameters' with value '${jqassistant.ruleParameters}' of type java.lang.String to property of type java.util.Map

Same error when formating the key-value-Pair like this:

  • KEY=VALUE
  • KEY:VALUE

I'm required to use the jQAssistant-Maven-Plugin this way, because I can't alter the Projects POM and won't be able to install jQAssistant any other way. Unfortunately I couldn't find anything about how to pass Maps as a command line argument with Maven.

Sorry for asking if this is a maven problem.

JerryTerra
  • 31
  • 1

1 Answers1

1

This is indeed more a Maven question: Internally the ruleParameters in the pom.xml are directly represented by a Map and the values are propagated by Maven. AFAIK there's no way to override this directly using properties on the command line.

A solution might be to have a template ruleParameters section in the pom.xml as such:

<ruleParameters>
  <my-rule.param>${myRuleParam}</my-rule.param>
</ruleParameters>

This would allow running

mvn jqassistant:analyze -DmyRuleParam=foo
Dirk Mahler
  • 1,186
  • 1
  • 6
  • 7