현재 build.xml이있는 프로젝트가 있습니다. 이 빌드에는 something.jar을 호출하는 CreateDB 명령이 있습니다. 이 jar는 일부 sql 스크립트 (mysql db)를 실행합니다. 이제 명령을 실행하여이 명령을 실행할 수 있습니다.Maven 및 mysql 종속성
ant CreateDB
명령 줄에서 실행할 수 있습니다. 하지만 지금, 나는 더 많은 것을 할 필요가 있습니다. Maven을 사용하여 응용 프로그램을 빌드 할 때 해당 ant 명령을 실행하려고합니다. 내가 MySQL 용 커넥터가없는 것 같다,이 메시지에 따르면
org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class 'org.gjt.mm.mysql.Driver'
: 그래서, 나는이 pom.xml 파일 (아래 참조)을 생성하지만, 작동하지 않는,이 오류가 발생했습니다 그러나 나는 그것을 나의 의존에 명시했다. 그래서 내가 뭘 잘못 했니?
의 pom.xml :
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.dl.test</groupId>
<artifactId>toto</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>toto</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.23</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>mysql</id>
<phase>integration-test</phase>
<configuration>
<tasks>
<!-- For MySql -->
<ant antfile="path\build.xml" target="createDB" />
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>