简体   繁体   中英

Spring MVC Step by Step into Maven

Could someone please help me convert the ANT scripts in

http://static.springsource.org/docs/Spring-MVC-step-by-step/part5.html

into MVN?

I'm confused do I still have to make .bat files if I'm manually placing the hsqldb into my pom.xml dependency?

Plus can someone please provide specific samples? Since http://mojo.codehaus.org/sql-maven-plugin/usage.html provides no such thing

Thanks :)

I hope these links from Spring's developers help you to porting sample project from Ant to Maven (but these articles about Spring 3):

Okay I've managed to get chapter 5 done. In your src/test/resources folder place copies of the following files (from previous chapters and this one):

  • create_products.sql
  • load_data.sql (change the " in the descriptions for ')
  • jdbc.properties
  • test-context.xml

Now these files are on the classpath so we don't have to worry about making them fully qualified.

Instead of creating the ant scripts for creating and populating the database I simply called the create_products.sql script in the onSetUpInTransaction() method of the JdbcProductDaoTests class.

@Override
protected void onSetUpInTransaction() throws Exception{
    super.executeSqlScript("classpath:create_products.sql", true);
    super.deleteFromTables(new String[] {"products"});
    super.executeSqlScript("classpath:load_data.sql", true);
}

In the jdbc.properties under the jdbc.url property set to jdbc:hsqldb:filename;shutdown=true;

After doing this my tests run and I don't have to start the db via the command prompt, I've found filename.script filename.properties for the database but I'm not sure where it is actually storing the data after I insert it to the database.

I guess this is something I can worry about in the next chapter?

Hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM