Problem on a multi-modules project

View: New views
3 Messages — Rating Filter:   Alert me  

Problem on a multi-modules project

by niaouli :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

I am using Cargo on a multi-module project.
Everything is perfect when I work on the module project : mvn clean install cargo:deployer-redeploy

But when I did the same in the parent project, I got an error : The plugin 'org.apache.maven.plugins:maven-cargo-plugin' does not exist or no valid version could be found
So I changed the line for : mvn clean install org.codehaus.cargo:cargo-maven2-plugin:deployer-redeploy
Then I got another problem : For all packaging other than war you need to configure the container you wishes to use.

I would like to be able to work directly from the parent module, in order to enable Hudson (my continuous integration engine) to deploy automatically this web application. You can see below my pom.xml files, for the parent and then the concerned module.

Thanks for your help. Regards,

Mickaël T.

---------------------

<project>
    <modelVersion>4.0.0</modelVersion>
    <groupId>nc.ird</groupId>
    <artifactId>MyProject</artifactId>
    <packaging>pom</packaging>
    <name>MyProject</name>
    <version>0.1-SNAPSHOT</version>
    <modules>
        <module>MyProject.domain</module>
        <module>MyProject.service</module>
        <module>MyProject.web</module>
    </modules>
    <!-- ... -->
</project>

---------------------

<project>
    <parent>
        <artifactId>MyProject</artifactId>
        <groupId>nc.ird</groupId>
        <version>0.1-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <groupId>nc.ird</groupId>
    <artifactId>MyProject.web</artifactId>
    <packaging>war</packaging>
    <name>MyProject.web</name>
    <version>0.1-SNAPSHOT</version>
    <properties>
        <deploy.host>deployHost</deploy.host>
        <deploy.port>8080</deploy.port>
        <deploy.user>deployUser</deploy.user>
        <deploy.password>deployPassword</deploy.password>
    </properties>
    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.cargo</groupId>
                <artifactId>cargo-maven2-plugin</artifactId>
                <configuration>
                    <container>
                        <containerId>tomcat6x</containerId>
                        <type>remote</type>
                    </container>
                    <configuration>
                        <type>runtime</type>
                        <properties>
                            <cargo.tomcat.manager.url>http://${deploy.host}:${deploy.port}/manager/</cargo.tomcat.manager.url>
                            <cargo.remote.username>${deploy.user}</cargo.remote.username>
                            <cargo.remote.password>${deploy.password}</cargo.remote.password>
                        </properties>
                    </configuration>
                    <deployer>
                        <type>remote</type>
                        <deployables>
                            <deployable>
                                <groupId>${project.groupId}</groupId>
                                <artifactId>${project.artifactId}</artifactId>
                                <type>war</type>
                                <pingURL>http://${deploy.host}:${deploy.port}/${parent.project.build.finalName}/</pingURL>
                            </deployable>
                        </deployables>
                    </deployer>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <!-- ... -->
</project>

Re: Problem on a multi-modules project

by pisajew :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sun, Sep 20, 2009 at 03:46:19PM -0700, niaouli wrote:
> I would like to be able to work directly from the parent module, in order to
> enable Hudson (my continuous integration engine) to deploy automatically
> this web application. You can see below my pom.xml files, for the parent and
> then the concerned module.
>

The easiest way I found to achieve this is to define execution in
submodule pom, and bind it to one of build phases. I.e. I did
something like:

  <build>
  <plugins>
  <plugin>
  <groupId>org.codehaus.cargo</groupId>
  <artifactId>cargo-maven2-plugin</artifactId>
  <version>1.0</version>
  <configuration>
  <container>
  <containerId>geronimo1x</containerId>
  <home>/usr/local/geronimo-jetty6-javaee5-2.1.4</home>
  </container>
  </configuration>
  <executions>
  <execution>
  <id>redeploy</id>
  <phase>install</phase>
  <goals>
  <goal>redeploy</goal>
  </goals>
  </execution>
  </executions>
  </plugin>
  </plugins>
  </build>
</project>

Now if you do mvn install (or any other goal that passes install
phase) for the master pom.xml it will execute cargo:redeploy for this
module.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Problem on a multi-modules project

by Ritesh Trivedi :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

One workaround I have found is to attach the cargo mojo to a phase e.g. package or deploy in your cargo plugin section. so when you do mvn deploy or package from parent, it seems to work without any errors.

You may also try to add cargo plugin in the parent as well either in the pluginmanagement or standalone. It might work.

niaouli wrote:
Hello,

I am using Cargo on a multi-module project.
Everything is perfect when I work on the module project : mvn clean install cargo:deployer-redeploy

But when I did the same in the parent project, I got an error : The plugin 'org.apache.maven.plugins:maven-cargo-plugin' does not exist or no valid version could be found
So I changed the line for : mvn clean install org.codehaus.cargo:cargo-maven2-plugin:deployer-redeploy
Then I got another problem : For all packaging other than war you need to configure the container you wishes to use.

I would like to be able to work directly from the parent module, in order to enable Hudson (my continuous integration engine) to deploy automatically this web application. You can see below my pom.xml files, for the parent and then the concerned module.

Thanks for your help. Regards,

Mickaël T.

---------------------

<project>
    <modelVersion>4.0.0</modelVersion>
    <groupId>nc.ird</groupId>
    <artifactId>MyProject</artifactId>
    <packaging>pom</packaging>
    <name>MyProject</name>
    <version>0.1-SNAPSHOT</version>
    <modules>
        <module>MyProject.domain</module>
        <module>MyProject.service</module>
        <module>MyProject.web</module>
    </modules>
    <!-- ... -->
</project>

---------------------

<project>
    <parent>
        <artifactId>MyProject</artifactId>
        <groupId>nc.ird</groupId>
        <version>0.1-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <groupId>nc.ird</groupId>
    <artifactId>MyProject.web</artifactId>
    <packaging>war</packaging>
    <name>MyProject.web</name>
    <version>0.1-SNAPSHOT</version>
    <properties>
        <deploy.host>deployHost</deploy.host>
        <deploy.port>8080</deploy.port>
        <deploy.user>deployUser</deploy.user>
        <deploy.password>deployPassword</deploy.password>
    </properties>
    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.cargo</groupId>
                <artifactId>cargo-maven2-plugin</artifactId>
                <configuration>
                    <container>
                        <containerId>tomcat6x</containerId>
                        <type>remote</type>
                    </container>
                    <configuration>
                        <type>runtime</type>
                        <properties>
                            <cargo.tomcat.manager.url>http://${deploy.host}:${deploy.port}/manager/</cargo.tomcat.manager.url>
                            <cargo.remote.username>${deploy.user}</cargo.remote.username>
                            <cargo.remote.password>${deploy.password}</cargo.remote.password>
                        </properties>
                    </configuration>
                    <deployer>
                        <type>remote</type>
                        <deployables>
                            <deployable>
                                <groupId>${project.groupId}</groupId>
                                <artifactId>${project.artifactId}</artifactId>
                                <type>war</type>
                                <pingURL>http://${deploy.host}:${deploy.port}/${parent.project.build.finalName}/</pingURL>
                            </deployable>
                        </deployables>
                    </deployer>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <!-- ... -->
</project>