Ah, the universal antrun solution. Guys, maven is better than ant, why do you keep using ant?

For copying the built file use dependency plugin:
 <build>
   <plugins>
     <plugin>
       <groupId>org.apache.maven.plugins</groupId>
       <artifactId>maven-dependency-plugin</artifactId>
       <executions>
         <execution>
           <id>copy-installed</id>
           <phase>install</phase>
           <goals>
             <goal>copy</goal>
           </goals>
           <configuration>
             <overWriteReleases>true</overWriteReleases>
             <overWriteSnapshots>true</overWriteSnapshots>
             <stripVersion>true</stripVersion>
             <artifactItems>
               <artifactItem>
                 <groupId>${project.groupId}</groupId>
                 <artifactId>${project.artifactId}</artifactId>
                 <version>${project.version}</version>
                 <type>${project.packaging}</type>
               </artifactItem>
             </artifactItems>

<outputDirectory>/home/stefan/jboss/server/default/deploy</outputDirectory>
           </configuration>
         </execution>
       </executions>
     </plugin>
   </plugins>
 </build>

To invoke things from other poms, use maven-invoker-plugin.

Regards,

Stefan


Ian Hummel wrote:
I use the antrun-maven-plugin to do things like this. I'm not sure if that's the right way though!

In your specific case you could try


    <build>
        ...
      <plugin>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
        <!-- bind to the "install" phase of the default lifecycle -->
          <execution>
            <phase>install</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
              <tasks>
                <copy todir="${todir}">
                  <fileset dir="${fromdir}" />
                </copy>
              </tasks>
            </configuration>
          </execution>
          <execution>
<!-- not sure in which phase you want to execute your sql command -->
            <phase>???</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
              <tasks>
                <!-- ant task to call subproject... -->
              </tasks>
            </configuration>
          </execution>
        </executions>
      </plugin>
    ...
</build>


here is some more info on lifecycles/phases: http://docs.codehaus.org/display/MAVENUSER/introduction-to-the-lifecycle



On Mar 5, 2008, at 8:02 AM, Martin Monsorno wrote:

Hi *,

there's one point I do not understand with maven: how can I use it to accomplish some tasks that doesn't seem to fit into the standard phases. The question arised when implementing continuous integration. For this I want to

- Copy a artefact to another directory. (more precisely: to deploy the generated war-file to the app server) This is no job for deploying something to a maven repository or generating a site, but just a plain copy task.

- Call a special goal of a subproject. (more precisely: my db subproject uses the hibernate-tools-plugin to execute some sql on the database) The subproject includes a plugin for a specific task, but I want to call this from the major build)

With maven 1.x, I wrote a maven.xml and defined goals for this. But what is the maven 2 way? Must I write a plugin?

Thanks for your thoughts,

Martin.

--
Martin




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to