testing Play framework and JPA.
I eclipsify my very simple test application. Import the project in eclipse and confirm that the play jar file is in my eclipse java build path: C:\play-2.0.2\repository\local\play\play_2.9.1\2.0.2\jars\play_2.9.1.jar
in my simple Item entity class, I import play.db.jpa.Model which my entity should extend
Here, eclipse is not be able to resolve the class!
Notice, the following jar file DOES NOT include the Model class - which I understand is essential in order to integrate with PLAY with JPA.
play_2.9.1.jar -> play\db\jpa\Model
the jpa only includes the following:
TransactionalAction$1.class
JPA.class
TransactionalAction.class
Transactional.class
JPAPlugin.class
JPA$1.class
what am I missing? do i include a wrong jar in my path?
where is Model.class??
Be sure to import play.db.ebean.*;, Play 2.0 uses Ebean for the Model extension.
Documentation can be found http://www.playframework.org/documentation/2.0.1/JavaEbean
Related
I'm used to creating custom Spring Boot based libraries with a number of different beans per library. A target Spring Boot app then would use #Import to make a subset of those Beans available w/out importing all of the beans from an external library. An external library would also include spring integration tests (i.e. #SpringBootTest).
I'm trying to replicate this functionality in Micronaut. I've created an external library using 'io.micronaut.library' gradle plugin. It also contains some micronaut integration tests (i.e. #MicronautTest).
Per https://docs.micronaut.io/latest/guide/#beanImport I expected none of the beans to be imported by default. However, I've noticed that a class annotated with #Singleton was imported by default. I suspect this is due to its inclusion in the META-INF/services/io.micronaut.inject.BeanDefinitionReference within the library jar. If I remove META-INF/services/io.micronaut.inject.BeanDefinitionReference from the jar manually then none of the beans are imported by default and I can use explicit #Import to import what is needed.
The package of the library is com.some.micronaut.http while application package is com.some.somethingelse so the namespaces do not match. Both the library and the application are written in Kotlin.
Is there a way to control which beans are imported from an external library? Or can I control which bean references are included in META-INF/services/io.micronaut.inject.BeanDefinitionReference?
Here is a relevant build.gradle portion from the external library:
plugins {
id("org.jetbrains.kotlin.jvm") version "${kotlinVersion}"
id("org.jetbrains.kotlin.kapt") version "${kotlinVersion}"
id("org.jetbrains.kotlin.plugin.allopen") version "${kotlinVersion}"
id 'io.micronaut.library' version "3.1.1"
}
dependencies {
implementation("io.micronaut:micronaut-http-client")
implementation("io.micronaut:micronaut-jackson-databind")
//test
testImplementation 'io.micronaut.test:micronaut-test-junit5'
testImplementation 'org.junit.jupiter:junit-jupiter-params'
//wiremock for http client tests
testImplementation 'com.github.tomakehurst:wiremock-jre8:2.32.0'
}
I'm flexible about usage of io.micronaut.library plugin but I do need to be able to run #MicronautTest as part of the library build.
For now, I've removed META-INF/services/io.micronaut.inject.BeanDefinitionReference from the library jar explicitly in my build.gradle:
jar {
exclude('META-INF/services/io.micronaut.inject.BeanDefinitionReference')
}
and then used #Import in my application to explicitly import the desired components. I've also submitted an enhancement request.
We are using Grails 2.4.5 and are trying to use the RestBuilder class to implement some functional tests for our REST API's.
I have included compile "org.grails.plugins:rest-client-builder:2.1.1" in the BuildConfig.groovy file.
I can see that the plugin is downloaded but do not see the RestBuilder class in any src directory. I also do not see any references to other dependencies that might include RestBuilder.
Could this be an issue when the plugin was upgraded/moved for Grails 3.x?
Thanks,
Kathy
Could this be an issue when the plugin was upgraded/moved for Grails
3.x?
No.
You are expressing a dependency on org.grails.plugins:rest-client-builder:2.1.1 which depends on org.grails:grails-datastore-rest-client:3.1.4.RELEASE and that is where grails.plugins.rest.client.RestBuilder is coming from. You should see the corresponding jar file under your home directory in /.grails/ivy-cache/org.grails/grails-datastore-rest-client/jars/grails-datastore-rest-client-3.1.4.RELEASE.jar.
I am using play framework version 2.2.0 and using play-querydsl plugin.
I am using Spring Data JPA version 1.7.2 integrated with play framework.
I am not using querydsl for all the model classes and only for few scenarios which are not supported by Spring Data JPA such as mixing more than one AND, OR checks in the WHERE clause.
Hence I would like to limit the generation of the QClasses by the play-querydsl plugin to few packages only and not all the packages which contain ENTITY classes.
I referred to https://github.com/CedricGatay/play-querydsl and added the QueryDSLPlugin.queryDSLPackage entry to my build.sbt as below :
playJavaSettings ++ QueryDSLPlugin.queryDSLSettings
QueryDSLPlugin.queryDSLPackage := "com.codetroopers.app.models"
But after this, when I try to build the play app using activator, the Q classes are not getting generated. When I removed the QueryDSLPlugin.queryDSLPackage entry from my build.sbt file, the Q classes are generated normally for all ENTITY classes inside models package.
Is there a way to limit the Q class generation by the plugin to only few packages or to only package ?
Vijay
Check out version 0.1.2 of the plugin -it's just been released. According to docs:
//From Play 2.3 and onward (thanks to autoImport feature)
queryDSLPackage := "com/codetroopers/app/models"
//OR Up to play 2.2
QueryDSLPlugin.queryDSLPackage := "com/codetroopers/app/models"
I'm using Play 2.3 and can confirm that it now works as expected (everything under com/codetroopers/app/models is scanned recursively).
I am trying to upgrade an old project from Spring 2.5.6 to Spring 3.1.0. The project is not built with Maven so I had to add the jars manually to the build path.
The application uses Eclipse RAP as well as Spring.
I added all the Spring 3.1 jars in my build path:
lib/org.springframework.aop-3.1.0.RELEASE.jar
lib/org.springframework.asm-3.1.0.RELEASE.jar
lib/org.springframework.aspects-3.1.0.RELEASE.jar
lib/org.springframework.beans-3.1.0.RELEASE.jar
lib/org.springframework.context-3.1.0.RELEASE.jar
lib/org.springframework.context.support-3.1.0.RELEASE.jar
lib/org.springframework.core-3.1.0.RELEASE.jar
lib/org.springframework.expression-3.1.0.RELEASE.jar
lib/org.springframework.instrument-3.1.0.RELEASE.jar
lib/org.springframework.instrument.tomcat-3.1.0.RELEASE.jar
lib/org.springframework.jdbc-3.1.0.RELEASE.jar
lib/org.springframework.jms-3.1.0.RELEASE.jar
lib/org.springframework.orm-3.1.0.RELEASE.jar
lib/org.springframework.oxm-3.1.0.RELEASE.jar
lib/org.springframework.test-3.1.0.RELEASE.jar
lib/org.springframework.transaction-3.1.0.RELEASE.jar
lib/org.springframework.web-3.1.0.RELEASE.jar
lib/org.springframework.web.portlet-3.1.0.RELEASE.jar
lib/org.springframework.web.servlet-3.1.0.RELEASE.jar
lib/org.springframework.web.struts-3.1.0.RELEASE.jar
and I also listed them in the MANIFEST.MF.
The project builds fine, but at runtime when trying to login it gives me the following error:
java.lang.NoClassDefFoundError: org/springframework/beans/factory/ListableBeanFactory
I looked in the beans jar and the class is definitely there. I also searched through the project and the class is not used explicitly anywhere.
What could cause this? Thank you in advance.
This class does not exist in Spring 3.1.0. See http://www.jarfinder.com/index.php/java/info/org.springframework.beans.factory.ListableBeanFactory
I have a grails project and I use the gwt plugin 0.6.1. GWT version is configured using ivy.
I have a strange unresolved symbol error when I try to use a class in package com.google.web.*. When I use the complete class names inline idea reports that it cannot resolve the web package. If I import the same class no error ocurres.
I already tried to run grails clean and removed the idea system directory as well - nothing works.
Idea usally import the class when I use smart complete but in this case idea insert the complete classname instead of importing the class.
The web package is found in the gwt-users-2.4.0.jar and gwt-servlet-2.4.0.jar. Both jars are in the classpath but this how the grails gwt plugin organizes gwt dependency.
Error when using full inline claasnames:
No error when using same class in import statement:
Does anyone have an idea?
Fixed already http://youtrack.jetbrains.net/issue/IDEA-81056
Fix is included in the next IDEA 11.1 EAP
http://confluence.jetbrains.com/display/IDEADEV/IDEA+11.1+EAP
I also had similar issue with IntelliJ IDEA, I solved problem by invalidating the idea cache. After invalidating the cache it will reindex all your library and other files. check this answer as well. Grails and IntelliJ Cache Issues