Open jeusdi opened 7 years ago
Seems to work properly for me with your provided sample project. I see the following output when run with gradle deployDevWildfly10 -i
.
Deployable artifacts = [/Users/bmuschko/dev/projects/gradle-playground/cargo/build/dist/webapi-dev-.war]
Starting action 'deploy' for remote container 'wildfly10x' on 'http://localhost:2200'
BTW: Did you intend to post your password in the code sample?
I've just realized that I'm getting different messages when I'm using --debug
and --info
.
When I perform gradle deployDevWildfly10 --info
I'm getting this message:
Deployable artifacts = [D:\projects\living\platform\commty\build\dists\commty-dev-de31042.war] Starting action 'deploy' for remote container 'wildfly10x' on 'http://localhost:9992' Container properties = [:] :deployDevWildfly10 FAILED
Otherwise, using gradle deployDevWildfly10 --debug
I'm getting these messages:
08:30:20.505 [DEBUG] [sun.net.www.protocol.http.HttpURLConnection] sun.net.www.MessageHeader@5b565a527 pairs: {POST /management/add-content HTTP/1.1: null}{Connection: close}{Content-Type: multipart/form-data; boundary=CargoBoundary}{User-Agent: Java/1.8.0_45}{Host: localhost:9990}{Accept: text/html, image/gif, image/jpeg, ; q=.2, /*; q=.2}{Content-Length: 29832076} 08:30:20.627 [DEBUG] [sun.net.www.protocol.http.HttpURLConnection] sun.net.www.MessageHeader@4a857f181 pairs: {Content-type: unknown/unknown} 08:30:20.627 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Finished executing task ':deployDevWildfly10' 08:30:20.627 [LIFECYCLE] [class org.gradle.internal.buildevents.TaskExecutionLogger] :deployDevWildfly10 FAILED
This is my last gradle script.
I've been trying it for a some days ago, and I'm not able reach my server.
Nevertheless, I'm able to log in using web interface.
Any ideas?
My guess is that you'll have to change the HTTP management port explicitly by a property. That's pre-set by Cargo. For more information see cargo.jboss.management-http.port
under Runtime Configuration Properties.
In your task creation you'll have to assign something to the property containerProperties
. Something like this (haven't tried it):
remoteContainers.each { config ->
task "deployDev${config.name.capitalize()}"(type: com.bmuschko.gradle.cargo.tasks.remote.CargoDeployRemote) {
containerProperties['cargo.jboss.management-http.port', 2222]
}
}
Thanks @bmuschko
I've added the containerProperties
:
remoteContainers.each { config ->
task "deployDev${config.name.capitalize()}"(type: com.bmuschko.gradle.cargo.tasks.remote.CargoDeployRemote) {
description = "Deploys WAR to remote Web Application Server: '${config.name}'."
containerId = config.container
hostname = config.hostname
port = config.port
username = config.username
password = config.password
context = "webapi"
dependsOn = [createDevelopmentWar]
deployables = [new com.bmuschko.gradle.cargo.convention.Deployable(file: createDevelopmentWar.archivePath)]
containerProperties['cargo.jboss.management-http.port', 9992]
}
Nevertheless, I keep getting the same message:
09:37:16.667 [DEBUG] [sun.net.www.protocol.http.HttpURLConnection] sun.net.www.MessageHeader@6bcedb777 pairs: {POST /management/add-content HTTP/1.1: null}{Connection: close}{Content-Type: multipart/form-data; boundary=CargoBoundary}{User-Agent: Java/1.8.0_45}{Host: localhost:9990}{Accept: text/html, image/gif, image/jpeg, ; q=.2, /*; q=.2}{Content-Length: 29869382}
I'd like you look at cargo
dependencies. Currently, I'm setting these dependencies in order to connect cargo with wildfly10:
dependencies {
cargo 'org.wildfly:wildfly-controller-client:8.2.0.Final'
cargo 'org.codehaus.cargo:cargo-core-uberjar:1.6.2'
cargo 'org.codehaus.cargo:cargo-ant:1.6.2'
}
Am I using the correct dependencies in order to connect cargo with a wildfly 10 instance?
In that I case I do not know. I suggest you ask about this on the Cargo user mailing list.
I have briefly checked the management-http functionality from Codehaus Cargo side, it should work if cargo.jboss.management-http.port is set in Cargo configuration. @jeusdi Can you check if that containerProperties value is propagated all the way down to Codehaus Cargo?
Thanks @sutaakar for your comment.
Nevertheless, I don't quite know what you exactly mean to... I mean, I don't know how to dig into Codehaus Cargo from my gradle script... Do you mean I take a look on debug? Nevertheless, how can I get this exactly information? Are you thinking about configuring any logger?
I think the messages I get from the task execution shows ho gradle plugin is reporting me correct port:
08:38:41.235 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter] Executing actions for task ':deployDevWildfly10'. 08:38:41.235 [INFO] [org.gradle.api.Task] Deployable artifacts = [D:\projects\living\platform\commty\build\dists\commty-dev-aefaba1-dirty.war] 08:38:41.236 [INFO] [org.gradle.api.Task] Starting action 'deploy' for remote container 'wildfly10x' on 'http://localhost:9992'
Nevertheless, it seems that it's trying to connect to 9990 instead of 9992:
08:38:42.130 [DEBUG] [sun.net.www.protocol.http.HttpURLConnection] sun.net.www.MessageHeader@78b79fc97 pairs: {POST /management/add-content HTTP/1.1: null}{Connection: close}{Content-Type: multipart/form-data; boundary=CargoBoundary}{User-Agent: Java/1.8.0_45}{Host: localhost:9990}{Accept: text/html, image/gif, image/jpeg, ; q=.2, /*; q=.2}{Content-Length: 29870112}
Sorry.
I meant, I'm absolutly willing to help out adquiring that information, but I don't quite how exactly get it.
Could you give me some lights?
@jeusdi Can you please debug your Cargo execution? If I understand correctly then this plugin should use Cargo Ant plugin. In that case every container property should be passed to Cargo core here: https://github.com/codehaus-cargo/cargo/blob/master/extensions/ant/tasks/src/main/java/org/codehaus/cargo/ant/ConfigurationElement.java#L325-L328
Can you please put a breakpoint there and check if cargo.jboss.management-http.port
is passed there?
Is there some tutorial showing how to debug and set a breakpoint to an Ant plugin from gradle? I've been to see, how to enable debugger on gradle, nevertheless, which code do I need to debug exactly?
You may try to use GRADLE_OPTS, see https://discuss.gradle.org/t/how-do-you-attach-a-debugger-to-gradle-so-that-i-can-debug-it-running-a-task/7526 . This Cargo Ant plugin can be debugged as any other java application, you will probably need to import the https://github.com/codehaus-cargo/cargo/tree/master/extensions/ant/tasks to be able to properly place debug point to the class.
I've imported code from repository. I've set a breakpoint on line 325 Gradle is listening on 5006.
Nevertheless, breakpoint is not reached. Any ideas?
Put a breakpoint to https://github.com/codehaus-cargo/cargo/blob/master/core/containers/wildfly/src/main/java/org/codehaus/cargo/container/wildfly/internal/AbstractWildFlyRemoteDeployer.java#L85 . This line should definitely be reached. If it is so check the value of management port. If it is 9990 then it is default value.
Try to backtrack to place where this deployer is instantiated. It is constructed with Container parameter. Container should be created using configuration, this configuration should contain property cargo.jboss.management-http.port
with your custom value.
It's not reached! Nevertheless, debugger is attached...
Try to put breakpoint to constructor - line 74.
It's not reached :anguished:
Seems that java debug has to be activated differently: https://docs.gradle.org/current/dsl/org.gradle.api.tasks.JavaExec.html try to use parameter --debug-jvm
I'm getting this message:
Problem configuring task :deployDevWildfly10 from command line. Unknown command-line option '--debug-jvm'.
Hmm, from https://discuss.gradle.org/t/how-do-you-attach-a-debugger-to-gradle-so-that-i-can-debug-it-running-a-task/7526/5 it seems that it can be possible to debug if you set jvm args in gradle.properties file.
I've ben able to reach this code: https://github.com/codehaus-cargo/cargo/blob/master/extensions/ant/tasks/src/main/java/org/codehaus/cargo/ant/CargoTask.java#L772
As you can see on image the port is 9990, instead of 9992!
Nevertheless, getContainer()
method returns a Container with this properties:
I've laso just realized 9992 value is set on cargo.servlet.port
instead of on cargo.jboss.management-http.port
Can you please check property cargo.jboss.management-http.port
in configuration properties?
cargo.servlet.port
property is used as port value for http communication - equals to system property jboss.http.port
. cargo.jboss.management-http.port
is port value for http management communication - the one we need for remote deployment.
Definitely, it seems cargo gradle plugin sends to cargo ant wrong values:
When addConfiguredProperty
is reached, is receives this Property
s:
cargo.servlet.port
= 9992
In fact, cargo.jboss.management-http.port
is not added.
@bmuschko I think the bug is around https://github.com/bmuschko/gradle-cargo-plugin/blob/master/src/main/groovy/com/bmuschko/gradle/cargo/tasks/remote/RemoteCargoContainerTask.groovy#L85
And it seems not reached:
Could you take a look, please?
@bmuschko , could I help out with anything more?
@bmuschko could you give us some feedback. Do you thing it's an issue related with gradle plugin?
@jeusdi I might be able to have a look within the next 2 weeks but I can't promise it.
@bmuschko Please, sorry for asking you for it again. Nevertheless, I'm still sticking in solving that.
Nevertheless, it would be really a great work around if it was ready...
Have you been able to take a look?
I'm getting this message:
Nevertheless, my task sets the port to connect to is 9992 instead of used 9990! So, the connection is refused! How could I change the port?