apache / apache/maven

[MNG-6005] not able to pass map kind of variables to maven goal through command line

Open
#7,714 4 comments 0 reactions 0 assignees View on GitHub
enhancement priority:minor
Dominant language
Java
Stars
5.3k
Forks
3.1k
Avg merge
20h 42m
Merged PRs (30d)
297

Description

**[gangadhar mamillapalli](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=gangadharonweb)** opened **[MNG-6005](https://issues.apache.org/jira/browse/MNG-6005?redirect=false)** and commented

am trying to pass Map kind of parameters to my maven plugin through command line. Here is how i tried,

> $mvn -U -X sample.plugin:hello-maven-plugin:1.0-SNAPSHOT:sayhi -Dsayhi.myMap=key1=value1

> $mvn -U -X sample.plugin:hello-maven-plugin:1.0-SNAPSHOT:sayhi -Dsayhi.myMap={key1=value1}

None of these are working and getting following error:

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

Here is my parameter in Mojo:

> /**
> * My Map.
> */
> `@Parameter`(property = "sayhi.myMap", required = false)
> private Map myMap = new HashMap();

followed instructions at ==> https://maven.apache.org/guides/mini/guide-configuring-plugins.html#Mapping_Collections, but no luck., i think am missing something very small. am working on maven v3.2.1

is am missing anything here ? am blocked on this.

i have also posted same question stackoverflow.
http://stackoverflow.com/questions/36678630/not-able-to-pass-map-kind-of-variables-to-maven-goal-through-command-line

thanks
Gangadhar M

---

**Affects:** 3.2.1

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.