MavenにSQLファイルを実行させたいのですが、Mavenが生成するデータベーススキーマは後でプログラムで使用されます。しかし、それは機能しません。おそらく「DELIMITER」が原因です。'mvn sql:execute'を実行すると、次のように出力されます。
[ERROR] Failed to execute: DELIMITER $$
これが私のpom.xmlの一部です
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sql-maven-plugin</artifactId>
<version>1.5</version>
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.21</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>init-schema</id>
<goals>
<goal>site</goal>
</goals>
<phase>deploy</phase>
</execution>
</executions>
<configuration>
<driver>com.mysql.jdbc.Driver</driver>
<username>root</username>
<password>root</password>
<url>jdbc:mysql://127.0.0.1:3306/?useUnicode=true&characterEncoding=UTF-8</url>
<autocommit>false</autocommit>
<srcFiles>
<srcFile>src/main/sql/jellyjolly-schema.sql</srcFile>
</srcFiles>
</configuration>
</plugin>
これが私のSQLファイルの一部です
DELIMITER $$
USE `jellyjolly_schema`$$
DROP TRIGGER IF EXISTS `jellyjolly_schema`.`delete_user` $$
USE `jellyjolly_schema`$$
CREATE TRIGGER delete_user
AFTER DELETE
ON jj_users
FOR EACH ROW
BEGIN
## delete the posts that belong to the user
DELETE FROM jj_blog_posts WHERE author_user_id=OLD.user_id;
END
$$
キーワード「DELIMITER」がMavenによって呼び出されるMySQLJavaコネクタでサポートされていないためです。では、どうすればそれを解決できますか?