私は、プロファイルを通して埋め込みデータベースを実行し、郵便配達員を通してREST呼び出しを実行する方法を理解しようとしていました。埋め込みH2データベースをmvn jettyで実行する:実行
<profile>
<id>developRest</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sql-maven-plugin</artifactId>
<version>1.5</version>
<dependencies>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>${h2.version}</version>
</dependency>
</dependencies>
<configuration>
<driver>org.h2.Driver</driver>
<url>jdbc:h2:mem:test</url>
<username>sa</username>
<password>sa</password>
</configuration>
<executions>
<execution>
<id>my-execution</id>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<autocommit>true</autocommit>
<srcFiles>
<srcFile>src/test/resources/table-ddl.sql</srcFile>
<srcFile>src/test/resources/insert-into-table.sql</srcFile>
</srcFiles>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>${jetty.version}</version>
<configuration>
<webApp>
<descriptor>src/main/webapp/WEB-INF/jetty.xml</descriptor>
</webApp>
<stopKey></stopKey>
<stopPort></stopPort>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>${h2.version}</version>
</dependency>
</dependencies>
</profile>
私は位相の周りにプレイしましたが、何も本当にこだわっているようだ: これは私がこれまで持っているものです。私は、MVNのSQLでこれを実行すると:私の実行の桟橋@実行:実行、サーブレットが実行されますが、私は残りのメソッドを呼び出した後、私は
Failed to execute goal org.codehaus.mojo:sql-maven-plugin:1.5:execute (my-execution) on project myProject: The parameters 'driver', 'url' for goal org.codehaus.mojo:sql-maven-plugin:1.5:execute are missing or invalid
を取得するには、私は、ドライバとURLが有効であるようになるだろう何をしないのですか?ご協力いただきありがとうございます。
アップデート:郵便配達からのGETを呼び出す場合
### Error querying database. Cause: org.h2.jdbc.JdbcSQLException: Table "myTable" not found; SQL statement:
:mvn -PdevelopRest sql:[email protected] jetty:run
は、ドライバとURLエラーの解消をまだして立ち往生するために使用します。何かご意見は?
私はメモリ内のデータベースを使用していません。私は本当に私ができることを望んでいた(とても便利なので!)。しかし、あなたは私が把握したいと思っていたそれが持続しないという点で正しいです。アドバイスありがとうございます。 Mavenエラーは、残りの呼び出しでデータベースに接続しようとしたためにポップアップします。しかし、私はH2サーバーを使用するように切り替えて接続して以来、私はもはやそのエラーが発生するので、dbは残っています。再度、感謝します! – Kevin