There's only one reason I can think of: your include file 
${basedir}/scripts/PROFILE1_CREATE_TABLES.sql doesn't exist.

If you're working on a casesensitive OS like linux every character must match!

If you know the filepath exactly (no ant-pattern required) and you don't need 
to filter these files, you should use srcFiles.

 

With "mvn help:evaluate" you can see how your expression will be resolved, that 
is:

${basedir}/scripts/${dataSource.createTablesScript}

 

 

- Robert

 

[1] http://mojo.codehaus.org/sql-maven-plugin/execute-mojo.html#srcFiles
 
> Date: Wed, 22 Sep 2010 07:01:08 -0700
> From: [email protected]
> To: [email protected]
> Subject: [mojo-user] I cannot execute some sql scripts !!
> 
> 
> Hi all, 
> 
> Here is the problem I have: I'd like to execute some sql scripts to create
> tables by using de sql plugin. But even though the conexion with the
> database is correct the scripts are no executed, so, here are the most
> relevating parts of the pom.xml 
> (I know it can be done, cause I used to do it with a postgresql database) 
> 
> <properties> 
> <jdbcDriver.className>oracle.jdbc.OracleDriver</jdbcDriver.className> 
> [....] 
> </properties>
> 
> 1 - This is only the profile i'm trying : 
> 
> <profiles> 
> 
> <profile> 
> <id>profile1</id> 
> <activation> 
> <activeByDefault>false</activeByDefault> 
> </activation> 
> <properties> 
> 
> <!-- Data source properties 
> --> 
> <dataSource.user>profile1</dataSource.user> 
> <dataSource.password>profile1</dataSource.password> 
> <dataSource.url>jdbc:oracle:thin:@localhost:1521:xe</dataSource.url> 
> 
> <dataSource.createTablesScript>PROFILE1_CREATE_TABLES.sql</dataSource.createTablesScript>
>  
> 
> </properties> 
> </profile> 
> 
> [...] 
> 
> </profiles>
> 
> 
> 2 - sql- plug-in: 
> 
> <plugin> 
> <groupId>org.codehaus.mojo</groupId> 
> <artifactId>sql-maven-plugin</artifactId> 
> 
> 
> <dependencies> 
> <!-- specify the dependent jdbc driver here --> 
> <dependency> 
> <groupId>com.oracle</groupId> 
> <artifactId>ojdbc14</artifactId> 
> <version>10.2.0.4</version> 
> </dependency> 
> </dependencies> 
> 
> <!-- common configuration shared by all executions --> 
> <configuration> 
> <driver>${jdbcDriver.className}</driver> 
> <url>${dataSource.url}</url> 
> <username>${dataSource.user}</username> 
> <password>${dataSource.password}</password> 
> <!-- You can comment out username/password configurations and 
> have maven to look them up in your settings.xml using
> ${settingsKey} 
> --> 
> <settingsKey>sensibleKey</settingsKey> 
> <!--all executions are ignored if -Dmaven.test.skip=true--> 
> <skip>${maven.test.skip}</skip> 
> 
> <fileset> 
> 
> 
> <basedir>${basedir}</basedir> 
> <includes> 
> <include>scripts/${dataSource.createTablesScript}</include> 
> </includes> 
> </fileset> 
> 
> </configuration> 
> 
> </plugin>
> 
> Now, I was trying without any executions, 'cause as I know they are no
> neccesaries unless you need to execute some test (or doing sth in the test
> db) , am I correct ? (I mean, I only need to execute the scripts to drop and
> create tables in my databases) 
> 
> this is the console output after execute the command: mvn -Pprofile1
> sql:execute 
> 
> for plugin:
> /plugins/org.codehaus.mojo:sql-maven-plugin:1...@2073705224/thread:main 
> [DEBUG] Looking up mojo org.codehaus.mojo:sql-maven-plugin:1.4:execute in
> realm /plugins/org.codehaus.mojo:sql-maven-plugin:1...@2073705224/thread:main
> -
> descRealmId=/plugins/org.codehaus.mojo:sql-maven-plugin:1...@2073705224/thread:main
>  
> [DEBUG] Looked up - org.codehaus.mojo.sql.sqlexecm...@16ea269 -
> ClassRealm[/plugins/org.codehaus.mojo:sql-maven-plugin:1...@2073705224/thread:main,
> parent: ClassRealm[plexus.core, parent: null]] 
> [DEBUG] Configuring mojo 'org.codehaus.mojo:sql-maven-plugin:1.4:execute'
> with basic configurator --> 
> [DEBUG] (f) autocommit = false 
> [DEBUG] (s) delimiter = ; 
> [DEBUG] (s) delimiterType = normal 
> [DEBUG] (s) driver = oracle.jdbc.OracleDriver 
> [DEBUG] (f) enableAnonymousPassword = false 
> [DEBUG] (s) escapeProcessing = true 
> [DEBUG] (s) basedir = C:\Entorno\workspace\comun 
> [DEBUG] (s) includes = [Ljava.lang.String;@1e12f6d 
> [DEBUG] (f) fileset = org.codehaus.mojo.sql.file...@f0b4a3 
> [DEBUG] (f) forceMojoExecution = false 
> [DEBUG] (s) keepFormat = false 
> [DEBUG] (f) mavenSession = org.apache.maven.execution.mavensess...@e753 
> [DEBUG] (s) onError = abort 
> [DEBUG] (f) outputDelimiter = , 
> [DEBUG] (s) password = profile1 
> [DEBUG] (f) project = MavenProject: es.everis:comun:0.0.1-SNAPSHOT @
> C:\Entorno\workspace\comun\pom.xml 
> [DEBUG] (f) settings = org.apache.maven.settings.setti...@46d228 
> [DEBUG] (f) settingsKey = sensibleKey 
> [DEBUG] (f) skip = false 
> [DEBUG] (f) skipOnConnectionError = false 
> [DEBUG] (s) url = jdbc:oracle:thin:@localhost:1521:xe 
> [DEBUG] (s) username = profile1 
> [DEBUG] -- end configuration -- 
> [INFO] [sql:execute] 
> [DEBUG] Setting context classloader for plugin to:
> /plugins/org.codehaus.mojo:sql-maven-plugin:1...@2073705224/thread:main
> (instance is:
> ClassRealm[/plugins/org.codehaus.mojo:sql-maven-plugin:1...@2073705224/thread:main,
> parent: ClassRealm[plexus.core, parent: null]]) 
> [DEBUG] connecting to jdbc:oracle:thin:@localhost:1521:xe 
> [DEBUG] Committing transaction 
> [INFO] 0 of 0 SQL statements executed successfully
> [DEBUG] disposing managed ClassRealm with id:
> /plugins/org.codehaus.mojo:sql-maven-plugin:1...@2073705224/thread:main 
> [DEBUG] dissociating all components from managed ClassRealm with id:
> /plugins/org.codehaus.mojo:sql-maven-plugin:1...@2073705224/thread:main 
> [INFO]
> ------------------------------------------------------------------------ 
> [INFO] BUILD SUCCESSFUL 
> [INFO]
> ------------------------------------------------------------------------ 
> [INFO] Total time: 8 seconds 
> [INFO] Finished at: Wed Sep 22 10:58:07 CEST 2010 
> [INFO] Final Memory: 2M/8M 
> [INFO]
> ------------------------------------------------------------------------ 
> 
> 
> As you can see there are no SQL statements executed, so I don't know if
> something needed is missing, in that case, what is that ??? or in the other
> hand maven can't find the script, in case, what I have to do ?? 
> 
> I'm even wondering if it can be because of using oracle, cause as I said up
> there, I used something like this with postgres. 
> 
> I tried an unexisted sql, and also write some uncorrect characters in the
> sql script and the result in both cases are the same put up there. 
> 
> Any idea is really welcome !!!
> -- 
> View this message in context: 
> http://old.nabble.com/I-cannot-execute-some-sql-scripts-%21%21-tp29779816p29779816.html
> Sent from the mojo - user mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
> 
> http://xircles.codehaus.org/manage_email
> 
> 
                                          

Reply via email to