1

In maven pom file, my project packaging type is "jar" like bellow.

<packaging>jar</packaging>

My cargo-maven2-plugin configuration in pom.xml file from the legacy code. I try to run it Eclipse Kelpler, but since the plugin configuration didn't mention cargo-maven2-plugin version(I don't know actual version for this configuration), Eclipse try to get the most recent one which is 1.4.8. Based on the configuration, the Tomcat version looks like 6.0.14, but container id is 5x. Whole configuration seems doesn't right and I try to make it work. Any suggestions? The package type must jar and I can't change it.

                <plugin>
                    <groupId>org.codehaus.cargo</groupId>
                    <artifactId>cargo-maven2-plugin</artifactId>
                    <configuration>
                        <wait>${cargo.wait}</wait>
                        <container>
                            <containerId>tomcat5x</containerId>
                            <zipUrlInstaller>
                                <url>
                                    http://archive.apache.org/dist/tomcat/tomcat-6/v${tomcat.version}/bin/apache-tomcat-${tomcat.version}.zip
                                </url>
                                <installDir>${installDir}</installDir>
                            </zipUrlInstaller>
                        </container>
                        <configuration>
                            <home>${project.build.directory}/tomcat5x/container</home>
                            <properties>
                                <cargo.hostname>${cargo.host}</cargo.hostname>
                                <cargo.servlet.port>${cargo.port}</cargo.servlet.port>
                            </properties>
                            <deployables>
                                <deployable>
                                    <properties>
                                        <context>ROOT</context>
                                    </properties>
                                </deployable>
                            </deployables>
                        </configuration>
                    </configuration>
                    <executions>
                        <execution>
                            <id>start-container</id>
                            <phase>pre-integration-test</phase>
                            <goals>
                                <goal>start</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>stop-container</id>
                            <phase>post-integration-test</phase>
                            <goals>
                                <goal>stop</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>  

            </plugins>
        </build>
    </profile>
</profiles>
<properties>
    <cargo.host>localhost</cargo.host>
    <cargo.port>25888</cargo.port>
    <cargo.wait>false</cargo.wait>
    <tomcat.version>6.0.14</tomcat.version>
</properties>

I set type for to "jar" to match project. But when I run maven build in Eclipse Kelper, I am getting following error message. As you can see there is no allowed type "jar" is listed. Could any one help?

org.codehaus.cargo.container.ContainerException: Cannot create deployable. There's no registered deployable for the parameters (container [id = [default]], deployable type [jar]). Valid types for this deployable are: 
  - ear
  - war
  - rar
  - bundle
  - file
  - sar
  - ejb
user3123690
  • 1,053
  • 5
  • 17
  • 27

1 Answers1

0

According to Cargo's Tomcat 5.x doc only war files can be deployed to tomcat, that's why it is failing. Why don't you use war to create a webapp? I don't know your requirements, but usually if you deploy on Tomcat you have a webapp in a war file. What do you need to do? Do you have a servlet or jsp file in your project? Do you need it to use it as a library for an other webapp?

You could create a web app and include the jar generated by that project as a dependency. Use org.apache.marmotta:marmotta-archetype-webapp Maven archetype to create your project and add your legacy project dependency to the pom, it would be something like this:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven v4_0_0.xsd">

  <modelVersion>4.0.0</modelVersion>
  <groupId>test.war</groupId>
  <artifactId>test-war</artifactId>
  <packaging>war</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>test-war Maven Webapp</name>
  <url>http://maven.apache.org</url>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <build>
    <finalName>test-war</finalName>
  </build>
  <dependencies>
      <dependency>
          <groupId>legacyProjectGroupId</groupId>
          <artifactId>legacyProjectArtifactId</artifactId>
          <version>legacyProjectVersion</version>
      </dependency>
  </dependencies>
</project>
Ale Sequeira
  • 2,039
  • 1
  • 11
  • 19