Closed albertotn closed 5 years ago
Good question, the plugin documentation isn't very clear on that. The master branch (versions without any suffix) are build and tested with wildfly 10 as target.
I know that for it to work with jboss 7 a different cli jar is needed (-jboss7 suffix), maybe for wildfly versions > 10 a diffent jar is needed as well.
I'd like to test plugin with wildfly 13, but I'm not sure how use the plugin with gradle 4.6 there is some kind of tutorial somewhere ?
kotlin dsl example:
import com.mkring.wildlydeplyplugin.DeployWildflyTask
plugins {
java
id("com.mkring.wildlydeplyplugin.deploy-wildfly-plugin") version "0.2.7"
}
group = "x.y"
version = "1.0-SNAPSHOT"
repositories {
mavenCentral()
}
dependencies {
testCompile("junit", "junit", "4.12")
}
configure<JavaPluginConvention> {
sourceCompatibility = JavaVersion.VERSION_1_8
}
task("deploy", DeployWildflyTask::class) {
host = "localhost"
port = 9090
user = "mgmt_user"
password = "mgmt_password"
deploymentName = project.name //cli: --name=$runtimeName
runtimeName = "${project.name}-$version.war" //cli: --runtime-name=$runtimeName
// filepath, here a war example
file = "$buildDir/libs/${project.name}-$version.war".apply { println("file=$this") }
}
groovy dsl example (i think, never used it from groovy):
import com.mkring.wildlydeplyplugin.DeployWildflyTask
plugins {
id("java")
id("com.mkring.wildlydeplyplugin.deploy-wildfly-plugin") version "0.2.7"
}
group = "x.y"
version = "1.0-SNAPSHOT"
repositories {
mavenCentral()
}
dependencies {
testCompile("junit:junit:4.12")
}
task deploy(type: DeployWildflyTask) {
host = "localhost"
port = 9090
user = "mgmt_user"
password = "mgmt_password"
deploymentName = project.name
runtimeName = project.name + "-" + version + ".war"
// filepath, here a war example
file = file("${buildDir}/libs/${project.name}-${version}.war")
}
Thanks for the support! The port I have to set is the management port for jboss, right ?
Yes, I think 9990 is the default value.
Did it work as expected? Do I need to adapt something for wildfly 13?
Sorry for being late, I have some erros.
My build.gradle configuration:
buildscript {
repositories {
mavenCentral()
jcenter()
}
}
import com.mkring.wildlydeplyplugin.DeployWildflyTask
plugins {
id 'war'
id "com.mkring.wildlydeplyplugin.deploy-wildfly-plugin" version "0.2.7"
}
def defaultEncoding = 'UTF-8'
compileJava {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
options.encoding = defaultEncoding
}
repositories {
//mavenLocal()
mavenCentral()
jcenter()
}
dependencies {
testCompile 'junit:junit:4.12'
}
task deploy(type: DeployWildflyTask) {
host = "127.0.0.1"
port = 9990
user = "admin"
password = "psw"
deploymentName = project.name //cli: --name=$runtimeName
runtimeName = "tmp.war" //cli: --runtime-name=$runtimeName
// filepath, here a war example
file = "$buildDir/libs/tmp.war"
}
Here the exception on deploy:
DeployWildflyPlugin applied :compileJava UP-TO-DATE :processResources UP-TO-DATE :classes UP-TO-DATE :war UP-TO-DATE :assemble UP-TO-DATE :compileTestJava UP-TO-DATE :processTestResources UP-TO-DATE :testClasses UP-TO-DATE :test UP-TO-DATE :check UP-TO-DATE :build UP-TO-DATE :deploy deployWildfly: going to deploy C:\Users\myuser\Desktop\test\esempioWorkBench\temp\BE\build/libs/test.war to 127.0.0.1:9990 deploy(): FileDeployer(file=C:\Users\myuser\Desktop\test\esempioWorkBench\test\BE\build/libs/test.war, host='127.0.0.1', port=9990, user=admin, reload=true, force=true, name=test, runtimeName=test.war, awaitReload=false) 127.0.0.1 DNS: /127.0.0.1 socket connect worked wildfly connect with admin on 127.0.0.1:9990 WARN: can't find jboss-cli.xml. Using default configuration values. JBREM000200: Remote connection failed: javax.security.sasl.SaslException: Authentication failed: the server presented no authentication mechanisms deployWildfly task failed: Unable to connect to controller. java.lang.IllegalStateException: Unable to connect to controller. at org.jboss.as.cli.scriptsupport.CLI.connect(CLI.java:154) at org.jboss.as.cli.scriptsupport.CLI.connect(CLI.java:135) at com.mkring.wildlydeplyplugin.FileDeployer.connect(FileDeployer.kt:130) at com.mkring.wildlydeplyplugin.FileDeployer.deploy(FileDeployer.kt:34) at com.mkring.wildlydeplyplugin.DeployWildflyTask.deployWildfly(DeployWildflyPlugin.kt:92) 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.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73) at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:46) at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39) at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26) at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:788) at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:755) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:124) at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336) at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328) at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:113) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:95) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:73) at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51) at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:59) at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54) at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:59) at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:101) at org.gradle.api.internal.tasks.execution.FinalizeInputFilePropertiesTaskExecuter.execute(FinalizeInputFilePropertiesTaskExecuter.java:44) at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:91) at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:62) at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:59) at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54) at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43) at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:256) at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336) at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328) at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:249) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:238) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:123) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:79) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:104) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:98) at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:663) at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:597) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:98) at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63) at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55) at java.lang.Thread.run(Thread.java:748) Caused by: org.jboss.as.cli.CommandLineException: Unable to authenticate against controller at 127.0.0.1:9990 at org.jboss.as.cli.impl.CommandContextImpl.tryConnection(CommandContextImpl.java:1013) at org.jboss.as.cli.impl.CommandContextImpl.connectController(CommandContextImpl.java:840) at org.jboss.as.cli.impl.CommandContextImpl.connectController(CommandContextImpl.java:819) at org.jboss.as.cli.scriptsupport.CLI.connect(CLI.java:150) ... 54 more Caused by: javax.security.sasl.SaslException: Authentication failed: the server presented no authentication mechanisms at org.jboss.remoting3.remote.ClientConnectionOpenListener$Capabilities.handleEvent(ClientConnectionOpenListener.java:388) at org.jboss.remoting3.remote.ClientConnectionOpenListener$Capabilities.handleEvent(ClientConnectionOpenListener.java:242) at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) at org.xnio.channels.TranslatingSuspendableChannel.handleReadable(TranslatingSuspendableChannel.java:199) at org.xnio.channels.TranslatingSuspendableChannel$1.handleEvent(TranslatingSuspendableChannel.java:113) at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) at org.xnio.ChannelListeners$DelegatingChannelListener.handleEvent(ChannelListeners.java:1092) at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) at org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66) at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:88) at org.xnio.nio.WorkerThread.run(WorkerThread.java:539) at ...asynchronous invocation...(Unknown Source) at org.jboss.remoting3.EndpointImpl.doConnect(EndpointImpl.java:272) at org.jboss.remoting3.EndpointImpl.doConnect(EndpointImpl.java:253) at org.jboss.remoting3.EndpointImpl.connect(EndpointImpl.java:351) at org.jboss.remoting3.EndpointImpl.connect(EndpointImpl.java:339) at org.jboss.as.protocol.ProtocolConnectionUtils.connect(ProtocolConnectionUtils.java:78) at org.jboss.as.protocol.ProtocolConnectionUtils.connectSync(ProtocolConnectionUtils.java:109) at org.jboss.as.protocol.ProtocolConnectionManager$EstablishingConnection.connect(ProtocolConnectionManager.java:256) at org.jboss.as.protocol.ProtocolConnectionManager.connect(ProtocolConnectionManager.java:70) at org.jboss.as.protocol.mgmt.FutureManagementChannel$Establishing.getChannel(FutureManagementChannel.java:204) at org.jboss.as.cli.impl.CLIModelControllerClient.getOrCreateChannel(CLIModelControllerClient.java:169) at org.jboss.as.cli.impl.CLIModelControllerClient$2.getChannel(CLIModelControllerClient.java:129) at org.jboss.as.protocol.mgmt.ManagementChannelHandler.executeRequest(ManagementChannelHandler.java:117) at org.jboss.as.protocol.mgmt.ManagementChannelHandler.executeRequest(ManagementChannelHandler.java:92) at org.jboss.as.controller.client.impl.AbstractModelControllerClient.executeRequest(AbstractModelControllerClient.java:236) at org.jboss.as.controller.client.impl.AbstractModelControllerClient.execute(AbstractModelControllerClient.java:141) at org.jboss.as.controller.client.impl.AbstractModelControllerClient.executeForResult(AbstractModelControllerClient.java:127) at org.jboss.as.controller.client.impl.AbstractModelControllerClient.execute(AbstractModelControllerClient.java:71) at org.jboss.as.cli.impl.CommandContextImpl.tryConnection(CommandContextImpl.java:1005) ... 57 more
BUILD SUCCESSFUL in 3s 9 actionable tasks: 1 executed, 8 up-to-date
You could probably make many people happier by adding this groovy dsl sample to the README.md. I took one afternoon and another morning to realise the import was necessary.
@aldonogueira done 👍
@albertotn: Can you connect manually using the jboss-cli? Is it a wildfly 13 with default config except the management user addition?
@Ingwersaft yes it's on my local machine with default config
@albertotn: I downloaded wildfly 14, added a mgmt-user and it worked for me.
task("deploy", DeployWildflyTask::class) {
host = "127.0.0.1"
port = 9990
user = "testuser"
password = "123"
deploymentName = "jolokia" //cli: --name=$runtimeName
runtimeName = "jolokia.run" //cli: --runtime-name=$runtimeName
// filepath, here a war example
file =
"$projectDir\\example-platforms\\jolokia-war-1.6.0.war".apply {
println("file=$this")
}
}
Are you sure you added a mgmt-user or didn't change the default ports?
closed because of inactivity
Hi! Which wildfly versions do you support ?