Comments (23)
You got to assign a stop key in your build script as well. Here's one example:
[tomcatRun, tomcatRunWar, tomcatStop]*.stopPort = 8090
[tomcatRun, tomcatRunWar, tomcatStop]*.stopKey = 'foo'
from gradle-tomcat-plugin.
Thanks.... but I still have an issue.
If I use this:
[tomcatRun, tomcatRunWar, tomcatStop]*.stopPort = 8090
[tomcatRun, tomcatRunWar, tomcatStop]*.stopKey = 'foo'
tomcatRun {
httpPort = 8080
daemon = true
}
The stop no longer errors out but tomcat is still running.
When I type "gradle tomcatRun", then "gradle tomcatStop", then "gradle tomcatRun" - I get a bind exception.
Ideas?
from gradle-tomcat-plugin.
Are you sure you want to run your Tomcat with the daemon option? Actually, the Gradle process would have stopped in between each of your calls. What's the exception you get?
from gradle-tomcat-plugin.
here is the output: https://gist.github.com/2148dc16a48d8b754b2d
The initial reason I use the daemon is here: http://forums.gradle.org/gradle/topics/cache_locking_error_gradle_m6
but even if that wasn't an issue, I'd like the option of a daemon.
from gradle-tomcat-plugin.
I see. You are running Gradle in daemon mode as well. It looks to me like you want to run in-container integration tests and then simply stop the Tomcat container. In that case I'd probably create a specific task to start up Tomcat, run the tests and then stop the container. Unfortunately, I don't have example code with me atm as I am traveling. I wanted to add that to the FAQ section at some point of time anyway. Have a look at this posting. It describes how you can set this up using the Jetty plugin. You can adept the code to make it work with the Tomcat plugin as well.
I'd have to have a look at why the container doesn't stop in Gradle daemon mode. It might be a bug.
from gradle-tomcat-plugin.
I am not quite sure why Gradle is behaving like this if you call gradle tomcatRun --daemon
but the problem does not occur if you run gradle --daemon
first before you run any other command. As the Gradle daemon feature is still an experimental feature it's still possible that it is buggy. Keep in mind that the Gradle daemon feature and the plugin daemon feature are two different things. You do not need to run Gradle in daemon mode for your in-container integration tests to work as you expect. I am going to close this issue for now. If you need further assistance please let me know. I will add an example on how to run integration tests using the Tomcat plugin in the FAQ section of the documentation soon.
from gradle-tomcat-plugin.
Hey Benjamin,
I'm currently experiencing the same issue: running gradle in daemon mode before starting a tomcat in a task lets the gradle-daemon bind the port but not releasing it after the task is done. I also posted in the gradle forum about it:
http://forums.gradle.org/gradle/topics/gradle_daemon_process_binds_port_but_never_releases_it
Cheers, Moritz
from gradle-tomcat-plugin.
Thanks for reporting this issue again I reopened the ticket and will have deeper look at it. Can you tell me which version of Gradle you are using?
from gradle-tomcat-plugin.
We're currently using version 1.1.
from gradle-tomcat-plugin.
Can someone please provide some steps to reproduce this.
from gradle-tomcat-plugin.
Sure.
- Add this line to the gradle.properties to enable the daemon:
org.gradle.daemon=true - Start task tomcatRunWar
- Check the port is being bind to the gradle process:
netstat -tulpn - When the gradle task is finished and the tomcat shutdown again, run the command from 3. again.
from gradle-tomcat-plugin.
How does the Gradle task “finish”? Does the user ctrl-c the build process?
from gradle-tomcat-plugin.
No, the task is done, therefore it finishes.
from gradle-tomcat-plugin.
How does tomcatRunWar know when to stop?
from gradle-tomcat-plugin.
E.g. the tests run against the tomcat are done and are calling tomcatStop.
from gradle-tomcat-plugin.
tomcatRunWar starts the tests?
from gradle-tomcat-plugin.
@moritzp82: Can you post your full build script or at least the relevant parts so we can get a good understanding of your the problem?
from gradle-tomcat-plugin.
Well, I can't post the full script but here is one task that's starting the tomcat
tomcatRunWar {
contextPath = ''
def testPort = System.properties['test.port']
if (testPort == null) {
testPort = '8080'
}
httpPort = testPort.toInteger()
stopPort = testPort.toInteger() + 1
tomcatStop.stopPort = stopPort
}
task webTests(type: Test, dependsOn: war) {
include '**/WebSuite.class'
doFirst {
systemProperties['webdriver.firefox.profile'] = System.properties['webdriver.firefox.profile']
if (systemProperties['webdriver.firefox.profile'] == null) {
systemProperties['webdriver.firefox.profile'] = 'default'
}
tomcatRunWar.daemon = true
tomcatRunWar.execute()
}
doLast {tomcatStop}
}
from gradle-tomcat-plugin.
@moritzp82: You are not executing the tomcatStop
task via tomcatStop.execute()
in the doLast
action.
from gradle-tomcat-plugin.
That's right. I fixed that but it does not fix the issue. The task is done:
Total time: 1 mins 36.272 secs
and the output of sudo lsof -i -n -P | grep LISTEN | grep java
still says the gradle process (daemon = true) is listening on port 8080:
java 3969 moritzprinz 61u IPv6 0xdf762f340bf6dc7b 0t0 TCP *:51069 (LISTEN)
java 3969 moritzprinz 266u IPv6 0xdf762f34119b5c7b 0t0 TCP *:8080 (LISTEN)
java 3969 moritzprinz 268u IPv6 0xdf762f34119b905b 0t0 TCP 127.0.0.1:8081 (LISTEN)
java 3969 moritzprinz 269u IPv6 0xdf762f34119b2c7b 0t0 TCP *:51189 (LISTEN)
java 3969 moritzprinz 369u IPv6 0xdf762f34119b305b 0t0 TCP *:2048 (LISTEN)
Just to show you that 3969 really is gradle:
hcpc2:~ moritzprinz$ ps aux | grep gradle
moritzprinz 4105 0.9 0.0 2432768 504 s003 R+ 9:17AM 0:00.00 grep gradle
moritzprinz 3969 0.0 3.6 4244008 596880 s003 S 9:13AM 2:38.98 /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java -XX:MaxPermSize=256m -XX:+HeapDumpOnOutOfMemoryError -Xmx1024m -Dfile.encoding=MacRoman -cp /Users/moritzprinz/gradle-1.1/lib/gradle-launcher-1.1.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 1.1 /Users/moritzprinz/.gradle/daemon 10800000 1de8281e-fcab-41f1-88e7-d09abb7615c3 -XX:MaxPermSize=256m -XX:+HeapDumpOnOutOfMemoryError -Xmx1024m -Dfile.encoding=MacRoman
from gradle-tomcat-plugin.
Has there been any update on this? I have just come across the same problem. I'm using gradle-tomcat-plugin:0.9.5 and gradle 1.3. Is there a workaround at all?
from gradle-tomcat-plugin.
Sorry, I haven't found any time to look into this in the meantime. Thanks for providing the information.
from gradle-tomcat-plugin.
This should be fixed by pull request #42.
from gradle-tomcat-plugin.
Related Issues (20)
- Daemon does not stop HOT 4
- Define which war to use HOT 9
- Gradle Daemon - Caused by: java.lang.Error: factory already defined HOT 2
- Can I tell `TomcatRun` where is the exploded web directory? HOT 1
- Documentation - add example to compile translated jsps HOT 1
- Setting default jsp package name from org.apache.jsp to your choice HOT 2
- Acessing environment variables with the plugin HOT 1
- Gradle 6.2.2 shows deprecation warning regarding jasperAttributes HOT 3
- IllegalArgumentException: The AJP Connector is configured with secretRequired="true" but the secret attribute is either null or "". HOT 7
- How to run the Tomcat server at http://localhost:8080 instead of http://localhost:8080/ProjectName? HOT 2
- Skip Jar Scanning for Annotations HOT 1
- tomcatRun fails with Gradle 7.0 due to @Internal annotation on private getter HOT 11
- 2.6 Release HOT 3
- How to configure environment variables when calling tomcatRun? HOT 1
- Tomcat 10 support
- HTTP2 support
- does this can do like maven tomcat plugin which can build jar not war HOT 1
- Remove usage of WarPluginConvention
- Getting groovy.lang.MissingMethodException after upgrading to tomcat plugin 2.7.0, was using 2.5 before HOT 1
- The AJP Connector is configured with secretRequired="true"
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gradle-tomcat-plugin.