db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Monroe <Greg.Mon...@dukece.com>
Subject RE: maven torque:insert-sql fails: org/apache/tools/ant/PropertyHelper
Date Thu, 22 Oct 2009 13:42:56 GMT
Sorry, not a big Maven user so I can't help with the specific Maven setup
problems.

FWIW, Torque isn't tied to Maven. It just makes it easier and has been 
the focus of the folks who document stuff. I've always used it with the 
included Ant xml (build-torque.xml).  It's easy to make calls to this
from our main ant build scripts.  Here's the set up I generally use:

Project Directories:

<proj root>/build (all things needed just to build but not run stuff).
<proj root>/build/torque (everything from the torque-gen distro)

In the torque directory is a build.properties file with all the setting
needed to generate stuff.

Here's some code to put in your main ant script to generate the OM code
and DB SQL scripts (if needed).  Just include the om target as a 
dependency in your main compile target(s):

<target name="check_om" description="Checks if DB structure has changed">
  <uptodate property="omBuild.notRequired"
            targetfile="${src.sql.dir}/${torque.schema.name}.sql">
    <srcfiles dir= "${src.schema.dir}" includes="${torque.schema.name}.xml"/>
    <srcfiles dir= "./build/torque" includes="build.properties"/>
  </uptodate>
</target>
       
<target name="om" depends="check_om"
        unless="omBuild.notRequired"
        description="Generate Object Model sources and SQL Scripts">
  <ant target="main" antfile="build-torque.xml" dir="./build/torque">
    <property name="build.properties" value="build.properties"/>
  </ant>
  <ant target="datadtd" antfile="build-torque.xml" dir="./build/torque">
    <property name="build.properties" value="build.properties"/>
  </ant>
</target>

==================

Now about Hibernate vs Torque... let's see... suppose you make a bunch 
of changes to the DB design.  

With Torque, just change a single XML schema files, recreate the OM layers 
via the build process, solve any compile issues (E.g. columns that
have been dropped or had a name change), use the Apache DDLUtil project to 
update any existing SQL DB server from the new XML (Toque and DDLUtil 
share the XML schema format) or create a new set of tables from the 
generated SQL script (or ant target) ....  You're done.

With Hibernate... hope you can finds all the places in the XML that refer
to the SQL changes. Hand modify all your code to change the names or 
remove the properties.  Hand write the SQL to create your new tables. 
Create a set of SQL update scripts for any existing DB (OK you can cheat
and use DDLUtil for this...)  Fix all the places that you missed as
bug reports come in...

Bottom line, IMHO, Torque may have a slightly higher start up cost to 
figure out how to get the build environment working... but overall it
will save you LOTS of development time...  But I'm biased :) 

> -----Original Message-----
> From: Jon August [mailto:jon@internection.com]
> Sent: Thursday, October 22, 2009 8:21 AM
> To: Apache Torque Users List
> Subject: Re: maven torque:insert-sql fails:
> org/apache/tools/ant/PropertyHelper
> 
> 
> I'll take that as a "read up on Hibernate".
> 
> 
> On Oct 22, 2009, at 8:14 AM, Alvaro Coronel wrote:
> 
> > Yeah, I love maven too ... NOT!
> >
> >
> >
> > ________________________________
> > From: Jon August <jon@internection.com>
> > To: Apache Torque Users List <torque-user@db.apache.org>
> > Sent: Thu, October 22, 2009 10:02:58 AM
> > Subject: Re: maven torque:insert-sql fails: org/apache/tools/ant/
> > PropertyHelper
> >
> > Alvaro,
> >
> > Thanks for your response.  My $CLASSPATH is empty and I don't know
> > where maven sets or gets it's classpath.  Where would I look to see
> > if it's duplicating  in the classpath...
> >
> > -Jon
> >
> >
> >
> > On Oct 22, 2009, at 8:00 AM, Alvaro Coronel wrote:
> >
> >> I didn't follow this thread from the start, so forgive me if I am
> >> wrong.
> >>
> >> I have seen many errors related to classes not found that were
> >> triggered by a duplication of the class.
> >>
> >> So not only do you have to check that it is included in the
> >> classpath. You also have to check that it is not included twice or
> >> more in the classpath.
> >>
> >> Hope this helps,
> >> Álvaro
> >>
> >>
> >>
> >> ________________________________
> >> From: Jon August <jon@internection.com>
> >> To: Apache Torque Users List <torque-user@db.apache.org>
> >> Sent: Thu, October 22, 2009 5:36:24 AM
> >> Subject: Re: maven torque:insert-sql fails: org/apache/tools/ant/
> >> PropertyHelper
> >>
> >> I had followed the directions for 3.3, but when I do this:
> >>
> >> maven plugin:download -DartifactId=maven-torque-plugin -
> >> DgroupId=torque -Dversion=3.2
> >>
> >> everything works fine...  Something wrong with 3.3?
> >>
> >>
> >>
> >>
> >>
> >> On Oct 22, 2009, at 1:06 AM, Jon August wrote:
> >>
> >>> I'm really stuck on this.  Clearly from the NoClassDefFound error
> >>> below in my last message, you would assume maven can't find ant...
> >>>
> >>> BUT, here it is in the local maven repository:
> >>> Mac:jars jon$ ls -al
> >>> total 2528
> >>> drwxr-xr-x  4 jon  staff      136 Oct 20 04:09 .
> >>> drwxr-xr-x  3 jon  staff      102 Oct 20 04:09 ..
> >>> -rw-r--r--  1 jon  staff  1289806 Oct 20 04:09 ant-1.7.0.jar
> >>> -rw-r--r--  1 jon  staff       75 Oct 20 04:09 ant-1.7.0.jar.md5
> >>>
> >>> Mac:jars jon$ pwd
> >>> /Users/jon/.maven/repository/org.apache.ant/jars
> >>>
> >>> AND, here it is in the path:
> >>> Mac:BizDirectory jon$ echo $PATH
> >>> /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/
> >>> local/maven-1.0.2/bin:/usr/local/apache-ant-1.7.0/bin:/
> >>> Applications/Mkvtoolnix.app/Contents/MacOS/
> >>>
> >>> AND, the library:
> >>> Mac:BizDirectory jon$ cd /usr/local/apache-ant-1.7.0/lib
> >>>
> >>> Mac:lib jon$ ls -al ant.jar
> >>> -rw-r--r--@ 1 jon  staff  1289806 Dec 13  2006 ant.jar
> >>>
> >>> Mac:lib jon$ jar -tvf ant.jar |grep PropertyHelper
> >>> 7526 Wed Dec 13 07:15:02 EST 2006 org/apache/tools/ant/
> >>> PropertyHelper.class
> >>>
> >>> It's in the repository IT created!  Why wouldn't it be able to
> >>> find that class?
> >>>
> >>> Any help is appreciated.  I'm ready to jump ship and try something
> >>> else.
> >>>
> >>> -Jon
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>> On Oct 20, 2009, at 4:33 PM, Jon August wrote:
> >>>
> >>>> Hmm - how do I make sure it has access to PropertyHelper?
> >>>>
> >>>> Thank you for your help.
> >>>>
> >>>> -Jon
> >>>>
> >>>>
> >>>> jon$ maven -e torque:insert-sql
> >>>> __  __
> >>>> |  \/  |__ _Apache__ ___
> >>>> | |\/| / _` \ V / -_) ' \  ~ intelligent projects ~
> >>>> |_|  |_\__,_|\_/\___|_||_|  v. 1.0.2
> >>>>
> >>>> Our new url -> jdbc:mysql://localhost/bizdirectory
> >>>> Executing file: /Users/jon/Documents/workspace/BizDirectory/
> >>>> target/sql/id-table-schema.sql
> >>>>
> >>>> BUILD FAILED
> >>>> java.lang.NoClassDefFoundError: org/apache/tools/ant/PropertyHelper
> >>>>   at org.apache.torque.task.TorqueSQLExec.runStatements
> >>>> (TorqueSQLExec.java:657)
> >>>>   at org.apache.torque.task.TorqueSQLExec
> >>>> $Transaction.runTransaction(TorqueSQLExec.java:928)
> >>>>   at org.apache.torque.task.TorqueSQLExec$Transaction.access$000
> >>>> (TorqueSQLExec.java:898)
> >>>>   at org.apache.torque.task.TorqueSQLExec.insertDatabaseSqlFiles
> >>>> (TorqueSQLExec.java:573)
> >>>>   at org.apache.torque.task.TorqueSQLExec.execute
> >>>> (TorqueSQLExec.java:482)
> >>>>   at org.apache.tools.ant.Task.perform(Task.java:341)
> >>>>   at org.apache.commons.jelly.tags.ant.AntTag.doTag(AntTag.java:
> >>>> 185)
> >>>>   at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:
> >>>> 279)
> >>>>   at org.apache.commons.jelly.impl.ScriptBlock.run
> >>>> (ScriptBlock.java:135)
> >>>>   at org.apache.maven.jelly.tags.werkz.MavenGoalTag.runBodyTag
> >>>> (MavenGoalTag.java:79)
> >>>>   at org.apache.maven.jelly.tags.werkz.MavenGoalTag
> >>>> $MavenGoalAction.performAction(MavenGoalTag.java:110)
> >>>>   at com.werken.werkz.Goal.fire(Goal.java:639)
> >>>>   at com.werken.werkz.Goal.attain(Goal.java:575)
> >>>>   at org.apache.maven.plugin.PluginManager.attainGoals
> >>>> (PluginManager.java:671)
> >>>>   at org.apache.maven.MavenSession.attainGoals(MavenSession.java:
> >>>> 263)
> >>>>   at org.apache.maven.cli.App.doMain(App.java:488)
> >>>>   at org.apache.maven.cli.App.main(App.java:1239)
> >>>>   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >>>>   at sun.reflect.NativeMethodAccessorImpl.invoke
> >>>> (NativeMethodAccessorImpl.java:39)
> >>>>   at sun.reflect.DelegatingMethodAccessorImpl.invoke
> >>>> (DelegatingMethodAccessorImpl.java:25)
> >>>>   at java.lang.reflect.Method.invoke(Method.java:597)
> >>>>   at com.werken.forehead.Forehead.run(Forehead.java:551)
> >>>>   at com.werken.forehead.Forehead.main(Forehead.java:581)
> >>>> Caused by: java.lang.ClassNotFoundException:
> >>>> org.apache.tools.ant.PropertyHelper
> >>>>   at org.apache.tools.ant.AntClassLoader.findClassInComponents
> >>>> (AntClassLoader.java:1075)
> >>>>   at org.apache.tools.ant.AntClassLoader.findClass
> >>>> (AntClassLoader.java:1036)
> >>>>   at org.apache.tools.ant.AntClassLoader.loadClass
> >>>> (AntClassLoader.java:925)
> >>>>   at java.lang.ClassLoader.loadClass(ClassLoader.java:254)
> >>>>   at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:399)
> >>>>   ... 23 more
> >>>> File...... /Users/jon/.maven/cache/maven-torque-plugin-3.3/
> >>>> plugin.jelly
> >>>> Element... torque-sql-exec
> >>>> Line...... 542
> >>>> Column.... 40
> >>>> org/apache/tools/ant/PropertyHelper
> >>>> Total time: 1 seconds
> >>>> Finished at: Tue Oct 20 16:30:40 EDT 2009
> >>>>
> >>>>
> >>>>
> >>>>
> >>>> On Oct 20, 2009, at 4:13 PM, Thomas Vandahl wrote:
> >>>>
> >>>>> Jon August wrote:
> >>>>>> I don't remember setting the classpath before to use torque.
> >>>>>>
> >>>>>> My shell's classpath is empty.  I use Eclipse to link libraries
> >>>>>> and
> >>>>>> compile...
> >>>>>>
> >>>>>> The version of ant maven is calling is this:
> >>>>>>
> >>>>>> jon$ ant -v
> >>>>>> Apache Ant version 1.7.0 compiled on July 20 2009
> >>>>>
> >>>>> I dimly remember version conflicts when seeing this class
> >>>>> reference.
> >>>>> What does "maven -e ..." tell you?
> >>>>>
> >>>>> Bye, Thomas
> >>>>>
> >>>>>
> >>>>> -------------------------------------------------------------------
> --
> >>>>> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> >>>>> For additional commands, e-mail: torque-user-help@db.apache.org
> >>>>>
> >>>>
> >>>
> >>
> >>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> > For additional commands, e-mail: torque-user-help@db.apache.org
> >
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org

DukeCE Privacy Statement:
Please be advised that this e-mail and any files transmitted with
it are confidential communication or may otherwise be privileged or
confidential and are intended solely for the individual or entity
to whom they are addressed. If you are not the intended recipient
you may not rely on the contents of this email or any attachments,
and we ask that you please not read, copy or retransmit this
communication, but reply to the sender and destroy the email, its
contents, and all copies thereof immediately. Any unauthorized
dissemination, distribution or copying of this communication is
strictly prohibited.

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message