Flyway和Maven集成 - 无法访问s3:// flyway-repo / release

时间:2017-05-10 09:36:06

标签: oracle maven flyway

我想将flyway与maven和oracle db集成。首先,如果有可能进行简单的迁移,我想做一个简单的测试,所以我将pom文件的构建部分作为以下内容(如flyway official page中所述):

<build>
    <plugins>
        <plugin>
            <groupId>org.flywaydb</groupId>
            <artifactId>flyway-maven-plugin</artifactId>
            <version>4.2.0</version>
            <configuration>
                <url>jdbc:oracle:thin:@localhost:1521:XE</url>
                <user>test</user>
                <password>test</password>
                <schemas>
                    <schema>TEST</schema>
                </schemas>
            </configuration>
            <dependencies>
                <dependency>
                    <groupId>com.oracle</groupId>
                    <artifactId>ojdbc14</artifactId>
                    <version>10.2.0.4.0</version>
                </dependency>
            </dependencies>
        </plugin>
    </plugins>
</build>

但是当我试图运行flyway:migrate或flyway:info目标时,我收到以下错误,我不知道连接的是什么..

[ERROR] Failed to execute goal org.flywaydb:flyway-maven-plugin:4.2.0:info (default-cli) on project gwm-admin: Execution default-cli of goal org.flywaydb:flyway-maven-plugin:4.2.0:info failed: Plugin org.fl
ywaydb:flyway-maven-plugin:4.2.0 or one of its dependencies could not be resolved: Could not transfer artifact com.oracle:ojdbc14:jar:10.2.0.4.0 from/to flyway-repo-private (s3://flyway-repo/release): Canno
t access s3://flyway-repo/release with type default using the available connector factories: BasicRepositoryConnectorFactory: Cannot access s3://flyway-repo/release using the registered transporter factorie
s: WagonTransporterFactory: java.util.NoSuchElementException
[ERROR]       role: org.apache.maven.wagon.Wagon
[ERROR]   roleHint: s3
[ERROR] -> [Help 1]

2 个答案:

答案 0 :(得分:1)

在评论中写道@ArkadiuszŁukasiewicz时,需要手动添加oracle jdbc驱动程序。有关更多信息,请访问:mkyong post

另一方面,在添加驱动程序后,我得到了另一个错误,可以通过将插件部分中的依赖项移动到pom.xml文件的主要依赖项中来解决

答案 1 :(得分:0)

使用此代码:

<properties>
        <maven.compiler.source> java version </maven.compiler.source>
        <maven.compiler.target> java version </maven.compiler.target>
</properties>

    <dependencies>
        <!-- Fly way -->
        <dependency>
            <groupId>com.googlecode.flyway</groupId>
            <artifactId>flyway-core</artifactId>
            <version>1.7</version>
        </dependency>
        <dependency>
           <groupId>com.oracle</groupId>
           <artifactId>ojdbc14</artifactId>
           <version>10.2.0.4.0</version>
       </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                (...)
            </plugin>
        </plugins>
    </build>