Versions Compared

Key

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

...

Code Block
java
java
LocalConfiguration configuration = new Tomcat6xStandaloneLocalConfiguration("target/tomcat6x");
Deployable war = new WAR("target/war/grails-example-without-libs.war");
configuration.addDeployable(war);

InstalledLocalContainer container = new Tomcat6xInstalledLocalContainer(configuration);
container.setHome("/srv/tomcat/catalina-home");

List<String> jars = new List<String>();
for (File jar : new File("/opt/grails").listFiles())
{
    if (jar.isFile())
    {
        jars.add(jar.getAbsolutePath());
    }
}

container.setSharedClasspath(jars.toArray());

container.start();

Example using the Ant

...

tasks

Starting a WAR on Tomcat 6.x with some additional classpath entries:

Code Block
xml
xml
<cargo containerId="tomcat6x" home="/srv/tomcat/catalina-home" action="start">
  <sharedClasspath>
    <fileset dir="/opt/grails">
      <include name="*.jar"/>
    </fileset>
  </sharedClasspath>
  <configuration home="target/tomcat6x">
    <deployable type="war" file="target/war/grails-example-without-libs.war"/>
  </configuration>
</cargo>

Example using the Maven 3 Plugin

Configuring a Tomcat6 Tomcat 6.x container with a com.foo bar-api-1.0.jar dependency provided using the shared classpath:

...