Cargo
  1. Cargo
  2. CARGO-596

Defining server settings in Maven's settings.xml

    Details

    • Type: New Feature New Feature
    • Status: Closed Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.0
    • Fix Version/s: 1.0.1-beta-2, 1.0.1-beta-3, 1.0.1
    • Component/s: Maven2
    • Labels:
      None
    • Environment:
      Maven2
    • Complexity:
      Intermediate
    • Patch Submitted:
      Yes
    • Number of attachments :
      2

      Description

      An interesting functionality for the Maven2 CARGO plug-in would be the following:

      1. The user enters all server information (connector URLs, user names, passwords, ...) in its settings.xml file
      2. When calling that server, it would only give the server name to CARGO and all options would be deduced automatically.

      An example:

      The Maven settings.xml file contains:

      [...]
      <servers>
      <server>
      <id>jonas1</id>
      <configuration>
      <cargo.remote.uri>jmx://jonas1</cargo.remote.uri>
      <cargo.jonas.domain.name>jonas</cargo.jonas.domain.name>
      <cargo.remote.username>jonas</cargo.remote.username>
      <cargo.remote.password>jonas</cargo.remote.password>
      </configuration>
      </server>
      <server>
      <id>jonas2</id>
      <configuration>
      <cargo.remote.uri>jmx://jonas2</cargo.remote.uri>
      <cargo.jonas.domain.name>jonas</cargo.jonas.domain.name>
      <cargo.remote.username>jonas</cargo.remote.username>
      <cargo.remote.password>jonas</cargo.remote.password>
      </configuration>
      </server>
      <servers>
      [...]

      In this case, the following configuration in a pom.xml file:

      [...]
      <plugin>
      <groupId>org.codehaus.cargo</groupId>
      <artifactId>cargo-maven2-plugin</artifactId>
      <version>1.0-SNAPSHOT</version>
      <configuration>
      <container>
      <containerId>jonas4x</containerId>
      <type>remote</type>
      </container>
      <configuration>
      <type>runtime</type>
      <properties>
      <cargo.jonas.server.name>jonas1</cargo.jonas.server.name>
      <cargo.jonas.domain.name>jonas</cargo.jonas.domain.name>
      </properties>
      </configuration>
      </configuration>
      </plugin>
      [...]

      would automatically be "expanded" into:

      [...]
      <plugin>
      <groupId>org.codehaus.cargo</groupId>
      <artifactId>cargo-maven2-plugin</artifactId>
      <version>1.0-SNAPSHOT</version>
      <configuration>
      <container>
      <containerId>jonas4x</containerId>
      <type>remote</type>
      </container>
      <configuration>
      <type>runtime</type>
      <properties>
      <cargo.remote.uri>jmx://jonas1</cargo.remote.uri>
      <cargo.remote.username>jonas</cargo.remote.username>
      <cargo.remote.password>jonas</cargo.remote.password>
      <cargo.jonas.server.name>jonas1</cargo.jonas.server.name>
      <cargo.jonas.domain.name>jonas</cargo.jonas.domain.name>
      </properties>
      </configuration>
      </configuration>
      </plugin>
      [...]

      I'm attaching the patch to the Maven plug-in to achieve the functionality

      1. settings.xml.patch
        8 kB
        Savas Ali Tokmen
      2. settings.xml.revised20080821.patch
        6 kB
        Savas Ali Tokmen

        Activity

        Hide
        Matt Wringe added a comment -

        This sounds like a good idea.

        The only comment I have with this it to call the variable that sets it something like cargo.server.settings instead of cargo.<container_name>.server.name to make it the same variable name across containers.

        Show
        Matt Wringe added a comment - This sounds like a good idea. The only comment I have with this it to call the variable that sets it something like cargo.server.settings instead of cargo.<container_name>.server.name to make it the same variable name across containers.
        Hide
        David J. M. Karlsen added a comment -

        Making maven inject the settings is probably better, this can be done like this:

        /

        • Access to settings.
        • @parameter expression="$ {settings}

          "

        • @readonly
          */
          private Settings settings;

        in a mojo.

        This also ensures correct correct beahviour when specifying the -s parameter when invoking maven:

        s,-settings Alternate path for the user settings file

        Show
        David J. M. Karlsen added a comment - Making maven inject the settings is probably better, this can be done like this: / Access to settings. @parameter expression="$ {settings} " @readonly */ private Settings settings; in a mojo. This also ensures correct correct beahviour when specifying the -s parameter when invoking maven: s, -settings Alternate path for the user settings file
        Hide
        Savas Ali Tokmen added a comment -

        Hello Matt, Hello David

        Thank you both for your interest in this functionality. I've taken both points into account and this new patch takes into account both remarks.

        Please tell me if you see any other issues.

        Show
        Savas Ali Tokmen added a comment - Hello Matt, Hello David Thank you both for your interest in this functionality. I've taken both points into account and this new patch takes into account both remarks. Please tell me if you see any other issues.
        Hide
        Savas Ali Tokmen added a comment -

        This has been fixed as of revision 1692. Functionality is operational, this bug can be closed now.

        Show
        Savas Ali Tokmen added a comment - This has been fixed as of revision 1692. Functionality is operational, this bug can be closed now.

          People

          • Assignee:
            Unassigned
            Reporter:
            Savas Ali Tokmen
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: