Hello everyone
I have posted this on the ant forum. The reason for this post on maven forum
is that I am not sure where the problem is originating from. I am trying to
use ddlutils with maven. No ready ddlutils plugin available for maven. So I
am working with ant-run plugin. When I run the maven pom file, I get the
following output. You can notice here that the echo statement echoes the
driver value from the properties file first time and then after that it does
not. I am not sure why this is happening. Could somebody throw somelight on
this.
Thanks
Venkat
My config:
<property file="./resources/ddlutils/Database.properties" prefix="db" />
<echo>${db.driver}</echo>
<taskdef
classname="org.apache.ddlutils.task.DatabaseToDdlTask" name="databaseToDdl"
classpathref="maven.compile.classpath" />
<databaseToDdl
usedelimitedsqlidentifiers="true" modelname="lean" verbosity="DEBUG">
<database
driverclassname="org.postgresql.Driver" url="${db.url}"
username="${db.username}" password="${db.password}" />
<writeschematofile
outputfile="./resources/database/schema-lean.xml" />
</databaseToDdl>
Error Stack Trace:
ven...@ubuntu:~/leanpm/implementation$ sudo mvn -e install
+ Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] Reactor build order:
[INFO] LeanPM
[INFO] Applications
[INFO] LeanPM parent
[INFO] LeanPMJAR
[INFO] LeanPMWAR
[INFO] LeanPMEAR
[INFO] AllModules
[INFO] BuildTools
[INFO] Delivery
[INFO]
------------------------------------------------------------------------
[INFO] Building LeanPM
[INFO] task-segment: [install]
[INFO]
------------------------------------------------------------------------
[INFO] [antrun:run {execution: ddlutils-compile}]
[INFO] Executing tasks
[echo] org.postgresql.Driver
Borrowed connection org.apache.commons.dbcp.poolableconnect...@19abd2b from
data source
Returning connection org.apache.commons.dbcp.poolableconnect...@19abd2b to
data source.
Remaining connections: None
Written schema to
/home/venkat/leanpm/implementation/resources/database/schema-lean.xml
[INFO] Executed tasks
[INFO] [site:attach-descriptor]
[INFO] [install:install]
[INFO] Installing /home/venkat/leanpm/implementation/pom.xml to
/.m2/repository/com/oniryx/leanPM/LeanPM/0.1-SNAPSHOT/LeanPM-0.1-SNAPSHOT.pom
[INFO]
------------------------------------------------------------------------
[INFO] Building Applications
[INFO] task-segment: [install]
[INFO]
------------------------------------------------------------------------
[INFO] [antrun:run {execution: ddlutils-compile}]
[INFO] Executing tasks
[echo] ${db.driver}
[INFO]
------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO]
------------------------------------------------------------------------
[INFO] An Ant BuildException has occured: Could not read the schema from the
specified database: Could not get a connection from the datasource
No suitable driver
[INFO]
------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: An Ant
BuildException has occured: Could not read the schema from the specified
database: Could not get a connection from the datasource
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:583)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:499)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:478)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:330)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:291)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:142)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:287)
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
org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at
org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoExecutionException: An Ant
BuildException has occured: Could not read the schema from the specified
database: Could not get a connection from the datasource
at
org.apache.maven.plugin.antrun.AbstractAntMojo.executeTasks(AbstractAntMojo.java:131)
at
org.apache.maven.plugin.antrun.AntRunMojo.execute(AntRunMojo.java:98)
at
org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:451)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:558)
... 16 more
Caused by: Could not read the schema from the specified database: Could not
get a connection from the datasource
at
org.apache.ddlutils.task.DatabaseToDdlTask.readModel(DatabaseToDdlTask.java:188)
at
org.apache.ddlutils.task.DatabaseTaskBase.execute(DatabaseTaskBase.java:365)
at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
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
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at
org.apache.maven.plugin.antrun.AbstractAntMojo.executeTasks(AbstractAntMojo.java:118)
... 19 more
Caused by: org.apache.ddlutils.DatabaseOperationException: Could not get a
connection from the datasource
at
org.apache.ddlutils.util.JdbcSupport.borrowConnection(JdbcSupport.java:151)
at
org.apache.ddlutils.platform.PlatformImplBase.readModelFromDatabase(PlatformImplBase.java:1900)
at
org.apache.ddlutils.task.DatabaseToDdlTask.readModel(DatabaseToDdlTask.java:181)
... 29 more
Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC
driver of class 'org.postgresql.Driver' for connect URL '${db.url}'
at
org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:780)
at
org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540)
at
org.apache.ddlutils.util.JdbcSupport.borrowConnection(JdbcSupport.java:134)
... 31 more
Caused by: java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getDriver(DriverManager.java:264)
at
org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:773)
... 33 more
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 17 seconds
[INFO] Finished at: Wed Feb 24 14:43:26 MST 2010
[INFO] Final Memory: 18M/81M
[INFO]
------------------------------------------------------------------------
--
View this message in context:
http://old.nabble.com/Ant-%2C-maven-%2C-antrun-%2C-ddlutils-tp27714325p27714325.html
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]