Related question:

In most of my projects I create command line tools. To get them up and running quickly, I use Ant and all the classpath configuration that is already defined in my build.xml.

I've seen that you're supposed to use Profiles to switch out plugin configurations, so I could use different profiles to change my antrun tasks, effectively creating targets.

But, is that the best practice? I assume that there are one of three choices. (Because, I explored making Maven switchable without writing plugins, and was told that profiles where it.)

1) Use profiles - Seemingly verbose. Does not feel as though I'm using it as the authors intended. If my program is only tangentially part of the build process, like a program that updates a database schema, it seems like it should be it's own program with it's own documentation, not a by product or variation of the build.

2) Keep a parallel build.xml - If I can execute the tasks using the ant plugin, then it might not be the duplication that it appears to be. Is there a way to inherit or export the classpath configurations in Maven? (Similarly, part of the build, but people have grown accustomed to supplemental Ant tasks that perform non-build tasks. Maven conventions make supplemental actions unconventional.)

3) Define some standard shell script / batch file pair that understands the Maven repository layout - Or perhaps one that conforms to some best practice for distributing a shell script / batch file launcher pair, the way Groovy and Ant do.

Assume that I want to write Java command line programs to aid my development by munging log files and the like, things that don't belong in a web interface.

Alan

On Jun 2, 2008, at 8:46 AM, [EMAIL PROTECTED] wrote:

Every maven plugin has documentation on the maven site. It is the best
place to look for answers to questions like this. See:
  http://maven.apache.org/plugins/maven-antrun-plugin/plugin-info.html

As the documentation says, writing a <target> tag is NOT allowed within
the pom.xml file.

So I would define this stuff in a separate build.xml file.  The antrun
plugin can then be configured to execute a task in this separate file,
using the <ant> tag. And you can run the file directly from ant when you
want.

FYI, you can run the ant definition directly with
  antrun:run
but you cannot specify a target as far as I can see. And that makes
sense, as the maven-antrun-plugin doesn't allow targets to be defined
within the pom.xml file.

Regards,
Simon

John Casey schrieb:
You should be able to simply call the hibernatetool without a target.
IIRC, the antrun plugin may not support targets.

-john

youhaodeyi wrote:
I use Maven runant plugin to execute ant task, see below:

<build>
        <plugins>
            <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <configuration>
                    <tasks>
                        <property name="output"
value="target/classes" />
                        <taskdef name="hibernatetool"
classname="org.hibernate.tool.ant.HibernateToolTask"
                            />

                        <target name="schema-recreate">
                            <hibernatetool destdir="${output}">
                                <configuration
configurationfile="${output}/hibernate.cfg.xml" />
                                <hbm2ddl drop="true" create="true"
export="true" update="false" />
                            </hibernatetool>
                        </target>
                    </tasks>
                </configuration>
            </plugin>
        </plugins>
    </build>
How can I run the target schema-recreate? I don't want o attach this
into
any Maven lifecycle.




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


--
Alan Gutierrez | [EMAIL PROTECTED] | http://blogometer.com/ | 504 717 1428
Think New Orleans | http://thinknola.com/



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

Reply via email to