Ok, good point, "want", "maven" and "plugin" should be replace by "forced to write a plugin in the absence of anything else that works" somewhere. :)

I think you can use an Ant Task http://maven.apache.org/ant- tasks.html to perform what you want inside maven2 and then either invoke a shell script http://ant.apache.org/manual/CoreTasks/ exec.html or if you want it to work on multiple platforms, use the ant scp http://ant.apache.org/manual/OptionalTasks/scp.html

Ian



On 6 Apr 2008, at 21:01, Santiago Gala wrote:
El dom, 06-04-2008 a las 20:46 +0100, Ian Boston escribió:
You probably want the Cargo plugin for maven, that deals with
deployment into a remote Tomcat, but I have found that buggy at times.


<ranting>
"want" and "(plugin)?.*maven" in the same sentence is actually bad
thinking. I'd say, at most: "You will probably be forced to use..."

I mean, maven should just take a simple local shell file with a
parameter to do
scp <artifact> <host>:<path>;
ssh <host> "cd <path> && mvn jetty:run-war"

or something similar, as any sane Makefile would do. Instead it requires
a lot of (hidden,buggy,xml-configured) java code to do every trivial
task. Which leads to a big documentation nightmare.
</ranting>

Regards
Santiago


or as you mention you can run inside maven with jetty, but then the
startup may take time.


In Sakai we (I) wrote a plugin to do the deployment to a tomcat
instance  (https://source.sakaiproject.org/svn/maven2/trunk/)

this works on a special target and just copies the war into a space
defined by maven.tomcat.home, it also deploys to shared, common,
server and a special target of component (which you can ignore)

The repo is at https://source.sakaiproject.org/maven2/org/
sakaiproject/maven/plugins/1.0/

the config is
<pluginRepositories>
.........
   <pluginRepository>
     <id>Sakai Plugin Repo</id>
     <url>http://source.sakaiproject.org/maven2</url>
     <releases>
       <enabled>true</enabled>
     </releases>
   </pluginRepository>
........
</pluginRepositories>

<build>
  ....
  <plugins>
.....
  <plugin>
         <inherited>true</inherited>
         <groupId>org.sakaiproject.maven.plugins</groupId>
         <artifactId>sakai</artifactId>
         <version>1.0</version>
         <extensions>true</extensions>
         <configuration>
           <deployDirectory>${maven.tomcat.home}</deployDirectory>
           <warSourceDirectory>${basedir}/src/webapp</
warSourceDirectory>
         </configuration>
       </plugin>
  ....
  </plugins>
...
</build>


mvn clean install sakai:deploy -Dmaven.tomcat.home=/opt/mytomcat

will build and deploy wars to a running instance. (with the sakai
plugin installed)

If you webdav (or something else) mount the target tomcat space, you
can deploy to a running server elsewhere.

The license on all of this is Educational Community License which is
compatible with A2, so you could just take it if you wanted or look
at it and take the ideas...its very simple and extends the basic
maven-war-plugin.

There is also something very similar in  the deployment plugin used
by Apache Pluto.


but this is just the way I have done it... officially, maven is not
really targeted at deployment to app servers.

Ian



On 6 Apr 2008, at 13:10, Alejandro Rivero wrote:
2008/4/6 Santiago Gala <[EMAIL PROTECTED]>:

 Doh! forget it. I needed to do mvn *install* (which actually does
not
install anything) to copy them to the hidden storage under my home.


Now I mention it, I whould thank to know some maven magic for this,
non for cp but for scp.

Point is, we installed all the shindig in a server machine, and our
people are more of php/py/etc than of java. As it happens, Eclipse can
do remote debug of a maven-jetty conumdrum without needing any new
plug-in beyond the default "java project" mode, but we need to do an
"mvn package" and scopy the xxx-source.jar file into Eclipse scope.

Some instructions for debug could actually do a pair of lines in the
README, after the hint of mnv jetty:run-war.

Alejandro

--
Santiago Gala
http://memojo.com/~sgala/blog/


Reply via email to