Coder Social home page Coder Social logo

gretty's People

Contributors

akhikhl avatar bitdeli-chef avatar dpanelli avatar gitter-badger avatar munnja001 avatar riceyeh avatar saladinkzn avatar saw303 avatar slavashvets avatar supermmx avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

gretty's Issues

Gretty does not shutdown Jetty process after abnormally terminating

If Gretty abnormally terminates, then the container (Jetty) does not stop. This may be a bug in Gretty [https://github.com/akhikhl/issues/214] or Gradle [https://issues.gradle.org/browse/GRADLE-2263] which will be released in Gradle 3.0.

Workaround: This empty AppStopTask task makes Jetty shutdown if any of the tests fail.

task ('shutdownHook', type: AppStopTask) << { } project.afterEvaluate { project.tasks.test.finalizedBy shutdownHook }
afterEvaluate makes sure the empty shutdownHook task runs when the test task exits from execution.

Feature for 1.2.6

  • New scanner for jdk 7+
  • Fix for: akhikhl#239
  • Fix for: akhikhl#195
  • Support overlays for war webapps in farms #4
  • Update jetty to 9.3 (by providing separate 'container' because latest jetty 9.3. compiled with jdk 8)
  • Add support for inserting paths before application output folders (will fix #6)
  • Add support for dependencies option in farm webapp configuration. #13
  • Fix for akhikhl#262
  • Fix for duplicate entries in getResources(path) in tomcat 7 and 8 #20

Code coverage for server side libraries in integration tests

Hi,

Thanks for continue supporting this.

I have a question about integration tests and coverage and I was hoping you can provide some clues on how to do this.

I have a server project setup using gretty and jacoco which work fine. This server is using a library (in the same gradle project) which I would like to have tested through the integration test but I'm having difficulties to configure this.

How can I include coverage for a library in the server side code coverage report?

I used the settings as provided in the gretty documentation to setup the integration tests:

dependencies {
    compile project(":serverlib")   // <-- these classes are also tested by the integrationTest
                                    //     and should also appear in the coverage report
                                    //     but I don't know how to do this
}

task('integrationTest', type: Test) {
    include '**/*IT.*'
}

tasks.test {
        exclude '**/*IT.*'
}

gretty {
  afterEvaluate {
      tasks.appBeforeIntegrationTest.jacoco {
          append = false
          destinationFile = project.file("$project.buildDir/jacoco/integrationTestServer.exec")
      }
      tasks.appAfterIntegrationTest.finalizedBy tasks.integrationTestServerReport
}

task('integrationTestServerReport', type: JacocoReport) {
        executionData { tasks.appBeforeIntegrationTest.jacoco.destinationFile }

        sourceDirectories = files(sourceSets.main.allSource.srcDirs)
        classDirectories = sourceSets.main.output

        def reportDir = reporting.file("jacoco/integrationTest_server/html")
        reports {
            html.destination = reportDir
        }
    }

I hope you can provide some hints on how to do this. Thanks!

Task - "integrationTest" always assumes, it needs to start tomcat before and stop after tests

This is same as created @ akhikhl#244


I am referring to the "Gretty Configuration" and understood that the default value for integrationTestTask is integrationTest.

We got few projects where we don't need the Tomcat needs to be running for integrationTest Task. and actually name of the integrationTest task is integrationTest. I am looking for Gretty Configurations to see, if I can say, I don't need Tomcat start and stop for my "integrationTest" task. Can you point me to right configuration if any.

Here are few other observations.
I tried setting the integrationTestTask as null or '', but I can still see the Tasks - appBeforeIntegrationTestand appAfterIntegrationTest getting executed.
The reason seems to be because appBeforeIntegrationTest.integrationTestTaskAssigned, appAfterIntegrationTest.integrationTestTaskAssigned is alwaystrue and it is not updated to 'false' when I am updating value of integrationTestTask to null or empty string?

Trigger hot deployment reload with a keypress

A very nice feature would be to trigger an app reload manually with a keypress instead of automatic scanning.
Doing a series of small changes, the webapp will keep restarting all the time, which consumes resources if a restart is taking a long time. When I finally want to see the changes, the webapp might be already in the process of restarting - I have to wait till it finishes and then restart it again.

My suggested solution is to have two modes - either automatic or manual reloading - in the same way as jetty-maven-plugin does.

using integration tests with gretty in combination with cobertura

Hi,

Now that I've got gretty working with jacoco I'm kind of disappointed with jacoco and I want to give cobertura a try.

I believe this should do the trick:

afterEvaluate {
    tasks.appBeforeIntegrationTest {
        gretty { 
              classPath "${project.buildDir}/instrumented_classes"
        }
    }
}

but it does not seem to work as it adds the instrumented_classes to the end of the classpath. For cobertura to work the instrumented_classes need to be at the front of the classpath (or the default build/classes/main entry removed from the classpath)

Do you have any idea or example on how to get cobertura to work with integration tests?

Allow farm/webapp task to include dependencies from repo

This issue is a possible duplicate of [https://github.com/akhikhl/issues/72].

With the farm/webapp task you cannot include additional dependencies other than what is in the maven dependency. Even if the webapp has a gradle.build, the user may not have access to add an additional dependency.

To work around this issue, I had to do download the dependency and add it to the classpath of the webapp:

farm { webapp "org.jasig.cas:cas-server-webapp:$cas_version", contextPath: '/cas', inplace: true, classPath: ["${project.projectDir}/etc/jars/cas-server-support-rest-4.2.1.jar"] ... }

These additional dependencies add behavior to the webapp that have been left out because the majority of users do not use this functionality.

I would like to do something like this:

farm { webapp "org.jasig.cas:cas-server-webapp:$cas_version", contextPath: '/cas', inplace: true, dependencies { "org.jasig.cas:cas-server-support-rest:4.2.1" } ... }

Overlays for repository based web apps in a farm

Hello,
Thanks for the effort of supporting this.

I'm having a problem. I want to have an overlay for a webapp in a farm. But the webapp does not come from a subproject. It is a maven artifact. I initially tried something like:

farm {
    webapp 'some-group-id:some-artifact-id:1.2.3', overlay: ':some-project'
}

According to the documentation (here) you can pass web-app-specific properties as named arguments (like this). The list of properties (here) lists overlays as a property. However, this is a method and can not be used in the context of the code snippet above.

I am continuing to read the code of gretty and trying to find a work-around. But it would be great if you have some input on this.

java.lang.NoClassDefFoundError when dependencies with mulit level project

java.lang.NoClassDefFoundError: com/project/c/CClass

projectA:
AController.java
@RestController
public class AController {

    @RequestMapping(value = "/print",method = RequestMethod.GET)
    public String print(){
        new BClass().print();
        return this.getClass().getName();
    }
}

dependencies{

    compile "org.springframework.boot:spring-boot-starter-web"

    compile project(":projectB")

}

ProjectB:
public class BClass {
    public void print(){
        new CClass().print();
        System.out.println(this.getClass().getName());
    }
}
dependencies{
    compile project(":projectC")
}

ProjectC:
public class CClass {
    public void print(){
        System.out.println(this.getClass().getName());
    }
}

access : http://localhost:8080/print
I got java.lang.NoClassDefFoundError: com/project/c/CClass

How can i do for this?thanks

LiveReload support

LiveReload is a really nice protocol to cause an automatic refresh on server-side events. We can use it in gretty (on fast reload or redeploy/restart)

Features for 1.2.5

  • Fix scanDependencies (akhikhl#170)
  • Allow to redeploy changed webapps instead of full restart (will be useful in farms)
  • Jetty version was updated to 9.2.15
  • Spring-loaded updated to 1.2.5.RELEASE (akhikhl#237)
  • Merged fix for contextPath = '/' (akhikhl#194)
  • Merged patch replacing groovy-all dependency with groovy modules (akhikhl#246)
  • fixed akhikhl#241
  • Added support for NeedClientAuth param (akhikhl#224)

Logger dependencies

This is actually related to this issue here: akhikhl#120

The problem is that Gretty is using Logback for its logging and this interferes with Log4j 2 logger. It would be great if Gretty used a generic way (like by using Slf4j) to leave the developer free which final logger implementation to use.

NPE with liveReload

java.lang.NullPointerException: Cannot invoke method triggerReload() on null object
        at org.codehaus.groovy.runtime.NullObject.invokeMethod(NullObject.java:91)
        at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:48)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
        at org.codehaus.groovy.runtime.callsite.NullCallSite.call(NullCallSite.java:35)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:117)
        at org.akhikhl.gretty.DefaultLauncher$_beforeJavaExec_closure2.doCall(DefaultLauncher.groovy:56)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1019)
        at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:42)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:117)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callSafe(AbstractCallSite.java:80)
        at org.akhikhl.gretty.scanner.BaseScannerManager$_scanFilesChanged_closure6.doCall(BaseScannerManager.groovy:238)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1019)
        at groovy.lang.Closure.call(Closure.java:426)
        at org.codehaus.groovy.runtime.DefaultGroovyMethods.callClosureForMapEntry(DefaultGroovyMethods.java:5226)
        at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2107)
        at org.codehaus.groovy.runtime.dgm$163.invoke(Unknown Source)
        at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:274)
        at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:56)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
        at org.akhikhl.gretty.scanner.BaseScannerManager.scanFilesChanged(BaseScannerManager.groovy:219)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1210)
        at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnCurrentN(ScriptBytecodeAdapter.java:82)
        at org.akhikhl.gretty.JettyScannerManager.this$dist$invoke$2(JettyScannerManager.groovy)
        at org.akhikhl.gretty.JettyScannerManager$1.methodMissing(JettyScannerManager.groovy)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
        at groovy.lang.MetaClassImpl.invokeMissingMethod(MetaClassImpl.java:936)
        at groovy.lang.MetaClassImpl.invokePropertyOrMissing(MetaClassImpl.java:1259)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1212)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1019)
        at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:69)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:166)
        at org.akhikhl.gretty.JettyScannerManager$1.filesChanged(JettyScannerManager.groovy:33)
        at org.eclipse.jetty.util.Scanner.reportBulkChanges(Scanner.java:685)
        at org.eclipse.jetty.util.Scanner.reportDifferences(Scanner.java:539)
        at org.eclipse.jetty.util.Scanner.scan(Scanner.java:391)
        at org.eclipse.jetty.util.Scanner$1.run(Scanner.java:329)
        at java.util.TimerThread.mainLoop(Timer.java:555)
        at java.util.TimerThread.run(Timer.java:505)

org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':farmBeforeIntegrationTest'

The build on May 29th might have broke the farmIntegrationTask:

…
:farmBeforeIntegrationTest FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':farmBeforeIntegrationTest'.
> Cannot get property 'file' on null object

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

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':farmBeforeIntegrationTest'.
…
Caused by: java.lang.NullPointerException: Cannot get property 'file' on null object
      at org.akhikhl.gretty.ProjectUtils.getFileFromConfiguration(ProjectUtils.groovy:166)
      at org.akhikhl.gretty.ProjectUtils$getFileFromConfiguration$7.callStatic(Unknown Source)
      at org.akhikhl.gretty.ProjectUtils.getDefaultWebAppConfigForMavenDependency(ProjectUtils.groovy:173)
      at org.akhikhl.gretty.ProjectUtils$getDefaultWebAppConfigForMavenDependency$6.call(Unknown Source)
      at org.akhikhl.gretty.FarmConfigurer.getWebAppConfigForMavenDependency(FarmConfigurer.groovy:69)
      at org.akhikhl.gretty.FarmConfigurer$_resolveWebAppRefs_closure7.doCall(FarmConfigurer.groovy:153)
      at org.akhikhl.gretty.FarmConfigurer.resolveWebAppRefs(FarmConfigurer.groovy:118)
      at org.akhikhl.gretty.FarmConfigurer$resolveWebAppRefs$4.call(Unknown Source)
      at org.akhikhl.gretty.FarmStartTask.getStartConfig(FarmStartTask.groovy:41)
      at org.akhikhl.gretty.FarmBeforeIntegrationTestTask_Decorated.getStartConfig(Unknown Source)
      at org.akhikhl.gretty.StartBaseTask.getLauncherConfig(StartBaseTask.groovy:141)
      at org.akhikhl.gretty.StartBaseTask.action(StartBaseTask.groovy:39)
…

I noticed org.akhikhl.gretty.ProjectUtils.groovy was modified on May 29th for this change:
#4 added overlay support to farms #18

[(https://github.com//pull/18/files)]

I reverted back to the 1.2.5 version of Gretty using the classPath attribute for webapp in my farm task and it works:

webapp "org.jasig.cas:cas-server-webapp:$cas_version", contextPath: '/cas', inplace: true, classPath: ["${project.projectDir}/etc/jars/cas-server-support-rest-4.2.1.jar"]

This line fails with 1.2.6-SNAPSHOT of Gretty using dependencies with the exception above:

webapp "org.jasig.cas:cas-server-webapp:$cas_version", contextPath: '/cas', inplace: true, dependencies: [ "org.jasig.cas:cas-server-support-rest:4.2.1" ]

Error using restartMode='redeploy' on tomcat 8

17:37:41 INFO  / -> realm config /home/sala/projects/marketplace/./etc/gretty/tomcat-users.xml
Exception in thread "main" java.lang.IllegalArgumentException: addChild:  Child name '' is not unique
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:711)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
        at org.apache.catalina.Container$addChild$3.call(Unknown Source)
        at org.akhikhl.gretty.TomcatServerManager$_redeploy_closure4.doCall(TomcatServerManager.groovy:96)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:324)
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:292)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1015)
        at groovy.lang.Closure.call(Closure.java:423)
        at groovy.lang.Closure.call(Closure.java:439)
        at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:1379)
        at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:1372)
        at org.codehaus.groovy.runtime.dgm$149.invoke(Unknown Source)
        at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:271)
        at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:53)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
        at org.akhikhl.gretty.TomcatServerManager.redeploy(TomcatServerManager.groovy:94)
        at org.akhikhl.gretty.ServerManager$redeploy$1.call(Unknown Source)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
        at org.akhikhl.gretty.Runner.run(Runner.groovy:139)
        at org.akhikhl.gretty.Runner.this$2$run(Runner.groovy)
        at org.akhikhl.gretty.Runner$this$2$run.call(Unknown Source)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:112)
        at org.akhikhl.gretty.Runner.main(Runner.groovy:44)

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.