Giter Club home page Giter Club logo

Comments (6)

divinespear avatar divinespear commented on September 26, 2024

Please put your persistence.xml.
BTW, provider will use defined in persistence.xml.

from jpa-schema-gradle-plugin.

divinespear avatar divinespear commented on September 26, 2024

not responding, closing issue.

from jpa-schema-gradle-plugin.

 avatar commented on September 26, 2024

Sorry, got busy with other issues.

This is my persistence XML:

<?xml version="1.0" encoding="UTF-8"?>
<persistence 
    version="2.1" 
    xmlns="http://xmlns.jcp.org/xml/ns/persistence" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">

    <persistence-unit name="default">
        <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
        <class>com.app.web.model.jpa.NewsItemPK</class>
        <class>com.app.web.model.jpa.NewsItem</class>
        <class>com.app.web.model.jpa.BinaryContentNewsItem</class>
        <class>com.app.web.model.jpa.TextContentNewsItem</class>
        <class>com.app.web.model.jpa.Category</class>
        <class>com.app.web.model.jpa.eclipselink.DateTimeJPA21Converter</class>
        <exclude-unlisted-classes>true</exclude-unlisted-classes>
        <properties>
            <property name="eclipselink.weaving" value="static"/>
            <property name="eclipselink.logging.logger" value="com.app.web.model.jpa.eclipselink.SLF4JLogger"/>
            <property name="eclipselink.logging.level" value="finest"/>
        </properties>
    </persistence-unit>
</persistence>

The config in gradle is:

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath "io.github.divinespear:jpa-schema-gradle-plugin:0.1.12"
    }
}

apply plugin: "jpa-schema-generate"

generateSchema {
    databaseProductName = "MySQL"
    scriptAction = "drop-and-create"
    format = true
    persistenceXml = file("src/main/resources/META-INF/persistence.xml")
}

When I run generateSchema I get this result, quoting Hibernate and saying that a Persistence Provider can't be found:


sts] -----------------------------------------------------
[sts] Starting Gradle build for the following tasks: 
[sts]      clean
[sts]      generateSchema
[sts] -----------------------------------------------------
:news-nx-scrollers2-common:clean
:news-nx-scrollers2-common:compileJava
:news-nx-scrollers2-common:processResources
:news-nx-scrollers2-common:classes
:news-nx-scrollers2-common:weave
:news-nx-scrollers2-common:generateSchema
HHH015016: Encountered a deprecated javax.persistence.spi.PersistenceProvider [org.hibernate.ejb.HibernatePersistence]; use [org.hibernate.jpa.HibernatePersistenceProvider] instead.
HHH015016: Encountered a deprecated javax.persistence.spi.PersistenceProvider [org.hibernate.ejb.HibernatePersistence]; use [org.hibernate.jpa.HibernatePersistenceProvider] instead.
HHH015016: Encountered a deprecated javax.persistence.spi.PersistenceProvider [org.hibernate.ejb.HibernatePersistence]; use [org.hibernate.jpa.HibernatePersistenceProvider] instead.
:news-nx-scrollers2-common:generateSchema FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':news-nx-scrollers2-common:generateSchema'.
> No Persistence provider to generate schema named default

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 1.397 secs
[sts] Build failed
org.gradle.tooling.BuildException: Could not execute build using Gradle installation '/opt/gradle-2.2.1'.

...
...

Caused by: javax.persistence.PersistenceException: No Persistence provider to generate schema named default
    at io.github.divinespear.JpaSchemaGenerateTask$_generate_closure9.doCall(JpaSchemaGenerateTask.groovy:301)
    at io.github.divinespear.JpaSchemaGenerateTask.generate(JpaSchemaGenerateTask.groovy:284)
    at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:63)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.doExecute(AnnotationProcessingTaskFactory.java:218)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:211)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:200)
    at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:579)
    at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:562)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
    ... 55 more

Note that my project does not declare Hibernate as a depedency.

from jpa-schema-gradle-plugin.

divinespear avatar divinespear commented on September 26, 2024

You can ignore persistenceXml option if your persistence xml path is META-INF/persistence.xml
remove it and retry please.

from jpa-schema-gradle-plugin.

divinespear avatar divinespear commented on September 26, 2024

... any luck?

from jpa-schema-gradle-plugin.

 avatar commented on September 26, 2024

Yes, now it works.

I have a suggestion though: please add a log line thatn states the
persistence engine the plugin selected in the end. This way it is always
clear which Persistence Provider is generating your DDL.

Thanks!

2015-02-24 19:59 GMT-05:00 divinespear [email protected]:

... any luck?


Reply to this email directly or view it on GitHub
#15 (comment)
.

from jpa-schema-gradle-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.