PlanetJava
Custom Search

java-maven-plugins-mojo-user
[Top] [All Lists]

Re: sql-maven-plugin: sql files need different delimiter configurations

Subject: Re: sql-maven-plugin: sql files need different delimiter configurations for packages and stored proceduees
Date: Wed, 23 Jun 2010 22:01:57 +0100
Robert, you suggestion works, so thank you. See my pom extract below.
I run my SQL using "mvn -Psql initialize". As you  stated said the sql
will only get run in the "sql" profile.
My "normal" build, such as "mvn clean install" does not execute the
sql. Which is fine. So thank you for your reply and the time you took
to reply. But this is very complex for something that should be
simple. (See further comments after the pom extract)
Here is the relevant extract of my pom:
  <build>
    ... ("NORMAL BUILD GOES HERE")
  </build>
  <profiles>
    <profile>
      <id>sql</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>sql-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>tables-etc</id>
                <phase>initialize</phase>
                <goals>
                  <goal>execute</goal>
                </goals>
                <configuration>
                  <srcFiles>
                    <srcFile>src/main/sql/tables/audit_log.sql</srcFile>
                    ...
                  </srcFiles>
                </configuration>
              </execution>
              <!-- packages used by the insertion of data cannot use
the default delimiter -->
              <execution>
                <id>packages</id>
                <phase>initialize</phase>
                <goals>
                  <goal>execute</goal>
                </goals>
                <configuration>
                  <delimiter>/</delimiter>
                  <srcFiles>
                    <!-- Packages -->
                    <srcFile>src/main/sql/packages/tools.sql</srcFile>
                    ...
                  </srcFiles>
                </configuration>
              </execution>
              <execution>
                <id>day0</id>
                <phase>initialize</phase>
                <goals>
                  <goal>execute</goal>
                </goals>
                <configuration>
                  <delimiter>;</delimiter>
                  <srcFiles>
                    <srcFile>src/main/sql/day0/role.sql</srcFile>
                    ...
                  </srcFiles>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
THIS pom  REALLY FRICKIN' SUCKS FROM A COMPLEXITY POINT OF VIEW
!!!!!!!!!!!!!!!!
This is what I should be able to write to change the delimiter for some files.:
  <build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>sql-maven-plugin</artifactId>
        <configuration>
          <srcFiles>
            <!-- Sequences -->
            <srcFile>src/main/sql/tables/role.sql</srcFile>
            <!-- Packages -->
            <srcFile delimiterType="row"
delimiter="/">src/main/sql/packages/tools.sql</srcFile>
            <!-- Day0 (must list files in order to satisfy integrity
constraints)  -->
            <srcFile>src/main/sql/data/role.sql</srcFile>
          </srcFiles>
        </configuration>
      </plugin>
    </plugins>
  </build>
Maven seems to make this common use case really hard!
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
    http://xircles.codehaus.org/manage_email
msgmiddle
<Prev in Thread] Current Thread [Next in Thread>
Current Sitemap | © 2012 planetjava | Contact | Privacy Policy