Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Definition

Excerpt

Properties to configure a container (request port, shutdown port, logging level, threads, etc)

Explanations

It is possible to set container configuration properties using the Cargo API. These properties are applied to a Configuration.

...

Support Matrix

Java

Ant

Maven2

IntelliJ IDEA

Netbeans

(tick)

(tick)

(tick)

(question)

(question)

Java API

Example of starting Tomcat 5.x on port 8081:

Code Block

Configuration configuration = 
    new Tomcat5xStandaloneLocalConfiguration("target/tomcat5x"));
configuration.setProperty(ServletPropertySet.PORT, "8081");
[...]

...

For example if you want to check if the configuration supports setting the port property:

Code Block

boolean isPropertySupported = configuration.getCapability().supportsProperty(ServletPropertySet.PORT);

...

Example of starting Tomcat 5.x on port 8081:

Code Block
xml
xml

<cargo containerId="tomcat5x" home="c:/apps/jakarta-tomcat-5.0.29" action="start">
  <configuration>
    <property name="cargo.servlet.port" value="8081"/>
  </configuration>
</cargo>

...

Example of starting Tomcat 5.x on port 8081:

Code Block
xml
xml

<build>
  <plugins>
    <plugin>
      <groupId>org.codehaus.cargo.maven2</groupId>
      <artifactId>cargo-maven2-plugin</artifactId>
      <configuration>
        <container>
          <containerId>tomcat5x</containerId>
          [...]
        </container>
        <configuration>
          <properties>
            <cargo.servlet.port>8081</cargo.servlet.port>
          </properties>
        </configuration>
        [...]
      </configuration>
    </plugin>
  </plugins>
</build>

...

Starting from CARGO 1.1.2, all configuration properties (be it with the Java API, ANT tasks or Maven2/Maven3 goals) can also be overriden using Java properties. For example, with Maven:

Code Block

mvn -Dcargo.servlet.port=8082 cargo:start