Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running this via maven plugin #53

Closed
matthewdfleming opened this issue Jun 19, 2014 · 9 comments
Closed

Running this via maven plugin #53

matthewdfleming opened this issue Jun 19, 2014 · 9 comments

Comments

@matthewdfleming
Copy link

I can't figure out how to get this to run from the maven plugin.. I keep getting:
Cannot find database driver: Driver class was not specified and could not be determined from the url (hibernate:ejb3:myPersistenceUnit)

Please let me know how I'm supposed to get this to go from maven.. the instructions are a bit sparse. Do I need to implement an interface?

-Matt

stack trace below:


[INFO] Settings
----------------------------
[INFO]     driver: org.h2.Driver
[INFO]     url: jdbc:h2:mem:adb;DB_CLOSE_DELAY=-1
[INFO]     username: sa
[INFO]     password: *****
[INFO]     use empty password: false
[INFO]     properties file: src/main/resources/liquibase.properties
[INFO]     properties file will override? false
[INFO]     prompt on non-local database? false
[INFO]     clear checksums? false
[INFO]     changeLogFile: src/main/resources/db.changelog-master.xml
[INFO]     context(s): dev
[INFO]     referenceDriver: null
[INFO]     referenceUrl: hibernate:ejb3:myPersistenceUnit
[INFO]     referenceUsername: null
[INFO]     referencePassword: null
[INFO]     referenceDefaultSchema: null
[INFO]     diffChangeLogFile: null
[INFO] ------------------------------------------------------------------------
[INFO] Executing on Database: jdbc:h2:mem:adb;DB_CLOSE_DELAY=-1
[INFO] Loading artfacts into URLClassLoader
[INFO]   artifact: file:/Users/matt/.m2/repository/org/liquibase/liquibase-core/3.2.0/liquibase-core-3.2.0.jar
[INFO]   artifact: file:/Users/matt/.m2/repository/commons-cli/commons-cli/1.2/commons-cli-1.2.jar
[INFO]   artifact: file:/Users/matt/.m2/repository/org/apache/velocity/velocity/1.7/velocity-1.7.jar
[INFO]   artifact: file:/Users/matt/.m2/repository/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar
[INFO]   artifact: file:/Users/matt/.m2/repository/commons-lang/commons-lang/2.4/commons-lang-2.4.jar
[INFO]   artifact: file:/Users/matt/.m2/repository/org/eclipse/jetty/jetty-servlet/8.1.14.v20131031/jetty-servlet-8.1.14.v20131031.jar
[INFO]   artifact: file:/Users/matt/.m2/repository/org/eclipse/jetty/jetty-security/8.1.14.v20131031/jetty-security-8.1.14.v20131031.jar
[INFO]   artifact: file:/Users/matt/.m2/repository/org/eclipse/jetty/jetty-server/8.1.14.v20131031/jetty-server-8.1.14.v20131031.jar
[INFO]   artifact: file:/Users/matt/.m2/repository/org/eclipse/jetty/orbit/javax.servlet/3.0.0.v201112011016/javax.servlet-3.0.0.v201112011016.jar
[INFO]   artifact: file:/Users/matt/.m2/repository/org/eclipse/jetty/jetty-continuation/8.1.14.v20131031/jetty-continuation-8.1.14.v20131031.jar
[INFO]   artifact: file:/Users/matt/.m2/repository/org/eclipse/jetty/jetty-http/8.1.14.v20131031/jetty-http-8.1.14.v20131031.jar
[INFO]   artifact: file:/Users/matt/.m2/repository/org/eclipse/jetty/jetty-io/8.1.14.v20131031/jetty-io-8.1.14.v20131031.jar
[INFO]   artifact: file:/Users/matt/.m2/repository/org/eclipse/jetty/jetty-util/8.1.14.v20131031/jetty-util-8.1.14.v20131031.jar
[INFO]   artifact: file:/Users/matt/.m2/repository/junit/junit/4.11/junit-4.11.jar
[INFO]   artifact: file:/Users/matt/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar
[INFO]   artifact: file:/Users/matt/.m2/repository/org/yaml/snakeyaml/1.13/snakeyaml-1.13.jar
[INFO]   artifact: file:/Users/matt/.m2/repository/org/liquibase/ext/liquibase-hibernate4/3.4/liquibase-hibernate4-3.4.jar
[INFO]   artifact: file:/Users/matt/.m2/repository/org/hibernate/hibernate-core/4.3.5.Final/hibernate-core-4.3.5.Final.jar
[INFO]   artifact: file:/Users/matt/.m2/repository/org/jboss/logging/jboss-logging/3.1.3.GA/jboss-logging-3.1.3.GA.jar
[INFO]   artifact: file:/Users/matt/.m2/repository/org/jboss/logging/jboss-logging-annotations/1.2.0.Beta1/jboss-logging-annotations-1.2.0.Beta1.jar
[INFO]   artifact: file:/Users/matt/.m2/repository/org/jboss/spec/javax/transaction/jboss-transaction-api_1.2_spec/1.0.0.Final/jboss-transaction-api_1.2_spec-1.0.0.Final.jar
[INFO]   artifact: file:/Users/matt/.m2/repository/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar
[INFO]   artifact: file:/Users/matt/.m2/repository/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.jar
[INFO]   artifact: file:/Users/matt/.m2/repository/org/hibernate/common/hibernate-commons-annotations/4.0.4.Final/hibernate-commons-annotations-4.0.4.Final.jar
[INFO]   artifact: file:/Users/matt/.m2/repository/org/hibernate/javax/persistence/hibernate-jpa-2.1-api/1.0.0.Final/hibernate-jpa-2.1-api-1.0.0.Final.jar
[INFO]   artifact: file:/Users/matt/.m2/repository/org/javassist/javassist/3.18.1-GA/javassist-3.18.1-GA.jar
[INFO]   artifact: file:/Users/matt/.m2/repository/antlr/antlr/2.7.7/antlr-2.7.7.jar
[INFO]   artifact: file:/Users/matt/.m2/repository/org/jboss/jandex/1.1.0.Final/jandex-1.1.0.Final.jar
[INFO]   artifact: file:/Users/matt/.m2/repository/org/hibernate/javax/persistence/hibernate-jpa-2.0-api/1.0.1.Final/hibernate-jpa-2.0-api-1.0.1.Final.jar
[INFO]   artifact: file:/Users/matt/.m2/repository/org/hibernate/hibernate-entitymanager/4.3.5.Final/hibernate-entitymanager-4.3.5.Final.jar
[INFO]   artifact: file:/Users/matt/.m2/repository/org/hibernate/hibernate-envers/4.3.1.Final/hibernate-envers-4.3.1.Final.jar
[INFO]   artifact: file:/Users/matt/.m2/repository/com/h2database/h2/1.4.178/h2-1.4.178.jar
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.374s
[INFO] Finished at: Thu Jun 19 16:13:06 CDT 2014
[INFO] Final Memory: 7M/18M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.liquibase:liquibase-maven-plugin:3.2.0:diff (default-cli) on project database: Error setting up or running Liquibase: liquibase.exception.DatabaseException: java.lang.RuntimeException: Cannot find database driver: Driver class was not specified and could not be determined from the url (hibernate:ejb3:myPersistenceUnit) -> [Help 1]
[ERROR] 
@matthewdfleming
Copy link
Author

I think I got it.. the key was to include this project as a dependency within the plugin itself (duh! I had it in my pom but not for the plugin itself). This got me past step one.. I'll keep posting if there are other issues..

        <plugin>
            <groupId>org.liquibase</groupId>
            <artifactId>liquibase-maven-plugin</artifactId>
            <version>${liquibase.version}</version>
            <configuration>
                <propertyFile>src/main/resources/liquibase.properties</propertyFile>
                <promptOnNonLocalDatabase>false</promptOnNonLocalDatabase>
            </configuration>
            <executions>
                <execution>
                    <phase>process-resources</phase>
                    <goals>
                        <goal>update</goal>
                    </goals>
                </execution>
            </executions>
            <dependencies>
                <dependency>
                    <groupId>org.liquibase.ext</groupId>
                    <artifactId>liquibase-hibernate4</artifactId>
                    <version>${liquibase.hibernate.version}</version>
                </dependency>
            </dependencies>
        </plugin>

@lmmworkv
Copy link

Did you ever get this working? What did your properties look like? I always get confused about which one is the referenceUrl and which one is the url.

@matthewdfleming
Copy link
Author

I did get it to go in some respects by creating a hibernate config xml file. However I quickly ran into this bug and decided to bag the whole thing. So now I'm running hbm2ddl via maven (in the test phase) and manually translating the ddl output to the console into liquibase scripts. It isn't ideal and it would be much cooler to be able to run a liquibase 'diff' but I had spent too much time on it and stopped caring. I found this plugin to not be truly production ready.. I'm sure there is a narrow use case in which it works well but I was outside of that range.

@malaguna
Copy link

I am using liquibase-maven-plugin 3.0.6 with liquibase-hibernate 3.0 and this combination works, although it has some bugs.

@m50d
Copy link

m50d commented Aug 15, 2014

Thanks. I got it working with liquibase-hibernate 3.4 and my own build of liquibase-maven-plugin 3.3.0-SNAPSHOT.

@malaguna
Copy link

Thanks! I am going to try it right now

@malaguna
Copy link

I just tried with latest liquibase-maven-plugin 3.3.0-SNAPSHOT and liquibase-hibernate 3.4, but it doesn't write any changeset when diffing from hibernate mappings to database.

@m50d
Copy link

m50d commented Aug 15, 2014

Ah, sorry, I forgot: I cloned from the pull request liquibase/liquibase#291 , and built msvticket's "CORE-1987" branch.

@malaguna
Copy link

Oh yeah! it works like a charm :) Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants