ops4j / org.ops4j.pax.construct

Build, manage and deploy many types of OSGi bundles
https://ops4j1.jira.com/wiki/display/paxconstruct/Pax+Construct
24 stars 14 forks source link

Better way of configuring command line arguments in the pom [PAXCONSTRUCT-116] #129

Open ops4j-issues opened 15 years ago

ops4j-issues commented 15 years ago

Richard Wallace created PAXCONSTRUCT-116

To pass custom arguments to pax runner you need to do something like

      <plugin>
        <groupId>org.ops4j</groupId>
        <artifactId>maven-pax-plugin</artifactId>
        <version>1.4</version>
        <configuration>
          <provision>
            <param>--workingDirectory=${project.build.directory}/runner</param>
            <param>--clean=true</param>
            <provision>mybundle</provision>
          </provision>
        </configuration>
      </plugin>

I only found this out by random chance looking at other project poms. It would be much clearer if the configuration could be more along the lines of

      <plugin>
        <groupId>org.ops4j</groupId>
        <artifactId>maven-pax-plugin</artifactId>
        <version>1.4</version>
        <configuration>
          <args>
            <workingDirectory>${project.build.directory}/runner</workingDirectory>
            <clean>true</clean>
          </args>
          <bundles>
            <bundle>mybundle</bundle>
          </bundles>
        </configuration>
      </plugin>

Affects: 1.4 Fixed in: 1.7.0 Votes: 0, Watches: 0

ops4j-issues commented 15 years ago

Stuart McCulloch commented

Maven only provides a few ways to pass lists/arrays of strings and the one we chose was:

<provision>
<param>sample</param>
<param>option</param>
<param>list</param>
<provision>

http://maven.apache.org/guides/plugin/guide-java-plugin-development.html

which Maven maps to

{ "sample", "option", "list" }

for the provision mojo parameter - note
that you can actually use any word for the tags inside <provision> we just happen to use
"param" as a convention - this format means you can configure any Pax-Runner setting
without the pax-plugin needing to know what settings are valid.

supporting a format like:

<args>
<workingDirectory>$

{project.build.directory}

/runner</workingDirectory>
<clean>true</clean>
</args>

is possible if we use a Map parameter - but then you would potentially lose ordering and
the ability to set multiple entries for the same setting.

similarly supporting:

<bundles>
<bundle>mybundle</bundle>
</bundles>

is possible by using another List parameter - although perhaps <scanners> would be a
better option, as you're actually telling pax-runner to scan a folder here rather than deploy
a specific artifact

one thing I definitely don't want to do is hard-code in-depth knowledge about pax-runner
settings inside the pax-plugin - we must also continue to support existing configurations

ops4j-issues commented 15 years ago

Stuart McCulloch commented

Target this for 1.5