Ingwersaft / wildfly-deploy-gradle-plugin

Gradle Plugin for deploying Files to Wildfly
https://plugins.gradle.org/plugin/com.mkring.wildlydeplyplugin.deploy-wildfly-plugin
GNU General Public License v3.0
10 stars 11 forks source link

NullPointer while trying to execute a batch command #12

Closed aldonogueira closed 5 years ago

aldonogueira commented 5 years ago

The config.cli file here has a batch command in it. It's something similar to this:

batch
/subsystem=naming/binding=java\:global\/server.jndi.host:add(binding-type=simple, type=java.lang.String, value="10.0.16.3")
/subsystem=naming/binding=java\:global\/server.jndi.port:add(binding-type=simple, type=java.lang.String, value="9201")
run-batch

...and the build.gradle has this:

task executeCommands(type: ExecuteWildflyTask) {
    host = deploy.host
    port = deploy.port
    user = deploy.user
    password = deploy.password
    commands = file('config.cli').readLines().findAll{ !it.isEmpty() }.collect()
}

When this task is executed, it gives this error:

...
going to execute `batch`
result: true
ExecuteWildflyTask task failed: null
java.lang.NullPointerException
        at com.mkring.wildlydeplyplugin.CliExecutioner.execute(CliExecutioner.kt:24)
        at com.mkring.wildlydeplyplugin.ExecuteWildflyTask.executeWildfly(ExecuteWildflyTask.kt:37)
...

It seems the response is empty and then returns null somewhere. It kind of make sense, because this command batch only instructs the server to receive more commands.

Ingwersaft commented 5 years ago

Can you check if the 0.2.9 version fixes your problem?

aldonogueira commented 5 years ago

We are almost there. The problem now is with the run-batch command

going to execute `batch`
result: true
response null
...
going to execute `/subsystem=datasources/xa-data-source=pronavDS:write-attribute(name=exception-sorter-class-name, value=org.jboss.jca.adapters.jdbc.extensions.oracle.OracleExceptionSorter)`
result: false
result string:
undefined
...
going to execute `run-batch`
ExecuteWildflyTask task failed: Error handling command: run-batch
java.lang.IllegalArgumentException: Error handling command: run-batch
        at org.jboss.as.cli.scriptsupport.CLI.cmd(CLI.java:189)
        at com.mkring.wildlydeplyplugin.CliExecutioner.execute(CliExecutioner.kt:22)
        at com.mkring.wildlydeplyplugin.ExecuteWildflyTask.executeWildfly(ExecuteWildflyTask.kt:37)
...

(Thank you for being so quick)

Ingwersaft commented 5 years ago

Can you add list-batch right before your run-batch and post the output? Also please don't shorten stacktraces :)

aldonogueira commented 5 years ago

Sorry! You are right. There is some (maybe) useful information down there:

ExecuteWildflyTask: on localhost:8889 going to execute:
`batch`
`/subsystem=naming/binding=java\:global\/server.jndi.host:add(binding-type=simple, type=java.lang.String, value="10.0.16.3")`
`/subsystem=naming/binding=java\:global\/server.jndi.port:add(binding-type=simple, type=java.lang.String, value="9201")`
`list-batch`
`run-batch`
deploy(): com.mkring.wildlydeplyplugin.CliExecutioner@56f341fc
localhost DNS: localhost/127.0.0.1
socket connect worked
wildfly connect with admin on localhost:8889
WARN: can't find jboss-cli.xml. Using default configuration values.
going to execute `batch`
result: true
response null
going to execute `/subsystem=naming/binding=java\:global\/server.jndi.host:add(binding-type=simple, type=java.lang.String, value="10.0.16.3")`
result: true
result string:
undefined
going to execute `/subsystem=naming/binding=java\:global\/server.jndi.port:add(binding-type=simple, type=java.lang.String, value="9201")`
result: true
result string:
undefined
going to execute `list-batch`
The batch is empty.
result: true
response null
going to execute `run-batch`
ExecuteWildflyTask task failed: Error handling command: run-batch
java.lang.IllegalArgumentException: Error handling command: run-batch
        at org.jboss.as.cli.scriptsupport.CLI.cmd(CLI.java:189)
        at com.mkring.wildlydeplyplugin.CliExecutioner.execute(CliExecutioner.kt:22)
        at com.mkring.wildlydeplyplugin.ExecuteWildflyTask.executeWildfly(ExecuteWildflyTask.kt:37)
        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:801)
        at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:768)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:131)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:300)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:292)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:174)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
        at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:120)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:99)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:77)
        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.api.internal.tasks.execution.EventFiringTaskExecuter$1.run(EventFiringTaskExecuter.java:51)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:300)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:292)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:174)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
        at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:46)
        at org.gradle.execution.taskgraph.LocalTaskInfoExecutor.execute(LocalTaskInfoExecutor.java:42)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareWorkItemExecutor.execute(DefaultTaskExecutionGraph.java:277)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareWorkItemExecutor.execute(DefaultTaskExecutionGraph.java:262)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:135)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:130)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker.execute(DefaultTaskPlanExecutor.java:200)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker.executeWithWork(DefaultTaskPlanExecutor.java:191)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker.run(DefaultTaskPlanExecutor.java:130)
        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: The batch failed with the following error (you are remaining in the batch editing mode to have a chance to correct the error)
        at org.jboss.as.cli.handlers.batch.BatchRunHandler.doHandle(BatchRunHandler.java:75)
        at org.jboss.as.cli.handlers.CommandHandlerWithHelp.handle(CommandHandlerWithHelp.java:88)
        at org.jboss.as.cli.impl.CommandContextImpl.handle(CommandContextImpl.java:614)
        at org.jboss.as.cli.scriptsupport.CLI.cmd(CLI.java:186)
        ... 54 more
Caused by: org.jboss.as.cli.CommandFormatException: Without arguments the command can be executed only in the batch mode.
        at org.jboss.as.cli.handlers.batch.BatchRunHandler.buildRequestWithoutHeaders(BatchRunHandler.java:145)
        at org.jboss.as.cli.handlers.BaseOperationCommand.buildRequestWOValidation(BaseOperationCommand.java:247)
        at org.jboss.as.cli.handlers.BaseOperationCommand.buildRequest(BaseOperationCommand.java:243)
        at org.jboss.as.cli.handlers.BaseOperationCommand.doHandle(BaseOperationCommand.java:225)
        at org.jboss.as.cli.handlers.batch.BatchRunHandler.doHandle(BatchRunHandler.java:72)
        ... 57 more

Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/4.10.2/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 1s
4 actionable tasks: 1 executed, 3 up-to-date
Ingwersaft commented 5 years ago
going to execute `list-batch`
The batch is empty.

Looks like it's a problem of your commands: Your batch is empty, probably because there are only non-batchable commands (which are executed immediately), therefore the run-batch command probably fails.

aldonogueira commented 5 years ago

I did two things:

Both worked fine... The list-batch showed the batched commands properly as well

Ingwersaft commented 5 years ago

https://developer.jboss.org/thread/250739 Only relevant search result i found: CLI.cmd() is a facade for the JBoss AS7 Command-line public API. I believe this API is at a lower level than where the "batch" command is handled, and it won't work that way.

No clue if this is (still) true.

Testing it with commands = ["run-batch --file=config.cli"] yields me:

going to execute `run-batch --file=config.cli`                                                                                                                                         
ExecuteWildflyTask task failed: Error handling command: run-batch --file=config.cli                                                                                                    
java.lang.IllegalArgumentException: Error handling command: run-batch --file=config.cli                                                                                                
        at org.jboss.as.cli.scriptsupport.CLI.cmd(CLI.java:189)                                                                                                                        
        at com.mkring.wildlydeplyplugin.CliExecutioner.execute(CliExecutioner.kt:22)                                                                                                   
        at com.mkring.wildlydeplyplugin.ExecuteWildflyTask.executeWildfly(ExecuteWildflyTask.kt:37)                                                                                    
        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:801)                                                                                       
        at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:768)                                                                                       
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:131)                                                               
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:300)                                   
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:292)                                   
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:174)                                                                
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)                                                                     
        at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)                                                               
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:120)                                                       
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:99)                                                       
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:77)                                                              
        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.api.internal.tasks.execution.EventFiringTaskExecuter$1.run(EventFiringTaskExecuter.java:51)                                                                      
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:300)                                   
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:292)                                   
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:174)                                                                
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)                                                                     
        at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)                                                               
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:46)                                                                    
        at org.gradle.execution.taskgraph.LocalTaskInfoExecutor.execute(LocalTaskInfoExecutor.java:42)                                                                                 
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareWorkItemExecutor.execute(DefaultTaskExecutionGraph.java:277)                                    
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareWorkItemExecutor.execute(DefaultTaskExecutionGraph.java:262)                                    
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:135)                                                           
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:130)                                                           
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker.execute(DefaultTaskPlanExecutor.java:200)                                                             
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker.executeWithWork(DefaultTaskPlanExecutor.java:191)                                                     
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker.run(DefaultTaskPlanExecutor.java:130)                                                                 
        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: The batch failed with the following error (you are remaining in the batch editing mode to have a chance to correct the error)        
        at org.jboss.as.cli.handlers.batch.BatchRunHandler.doHandle(BatchRunHandler.java:75)                                                                                           
        at org.jboss.as.cli.handlers.CommandHandlerWithHelp.handle(CommandHandlerWithHelp.java:88)                                                                                     
        at org.jboss.as.cli.impl.CommandContextImpl.handle(CommandContextImpl.java:614)                                                                                                
        at org.jboss.as.cli.scriptsupport.CLI.cmd(CLI.java:186)                                                                                                                        
        ... 54 more                                                                                                                                                                    
Caused by: org.jboss.as.cli.CommandFormatException: Failed to create batch from C:\Users\CUBE\IdeaProjects\wildfly-deploy-gradle-plugin\example-platforms\config.cli                   
        at org.jboss.as.cli.handlers.batch.BatchRunHandler.buildRequestWithoutHeaders(BatchRunHandler.java:131)                                                                        
        at org.jboss.as.cli.handlers.BaseOperationCommand.buildRequestWOValidation(BaseOperationCommand.java:247)                                                                      
        at org.jboss.as.cli.handlers.BaseOperationCommand.buildRequest(BaseOperationCommand.java:243)                                                                                  
        at org.jboss.as.cli.handlers.BaseOperationCommand.doHandle(BaseOperationCommand.java:225)                                                                                      
        at org.jboss.as.cli.handlers.batch.BatchRunHandler.doHandle(BatchRunHandler.java:72)                                                                                           
        ... 57 more                                                                                                                                                                    
Caused by: org.jboss.as.cli.operation.OperationFormatException: The command is not allowed in a batch.                                                                                 
        at org.jboss.as.cli.impl.CommandContextImpl.buildRequest(CommandContextImpl.java:1193)                                                                                         
        at org.jboss.as.cli.impl.CommandContextImpl.toBatchedCommand(CommandContextImpl.java:1159)                                                                                     
        at org.jboss.as.cli.handlers.batch.BatchRunHandler.buildRequestWithoutHeaders(BatchRunHandler.java:124)                                                                        
        ... 61 more                                                                                                                                                                    
aldonogueira commented 5 years ago

Maybe you could try a newer wildfly-cli dependency.

In your build.gradle.kts there is this line compile("org.wildfly", "wildfly-cli", "8.2.1.Final")
The error we get is consistent with this code, which is four years old. It doesn't mention batch commands.

On the other hand, the code on this other repository seems to be prepared for batch commands. This is the latest stable release, I think. It seems they changed the group name from org.wildfly to org.wildfly.core and restarted the numbering. It's confusing.

To use this code you would have to modify the dependency to compile("org.wildfly.core", "wildfly-cli", "7.0.0.Final")

Ingwersaft commented 5 years ago

Maybe you can test it yourself? You can replace a gradle plugin using settings.gradle. If you add the maven publish plugin to your adapted wildfly-deploy-gradle-plugin you should be able to use your local one easily.

aldonogueira commented 5 years ago

Couldn't make it work :( I have added the following to the beginning of the settings.gradle, but the error is exactly the same in the same lines, indicating no substitution occurred.

pluginManagement {
    resolutionStrategy {
        eachPlugin {
            if (requested.id.namespace == 'org.wildfly') {
                useModule('org.wildfly.core:wildfly-cli:7.0.0.Final')
            }
        }
    }
    repositories {
        maven {
            url '../maven-repo'
        }
        gradlePluginPortal()
        ivy {
            url '../ivy-repo'
        }
    }
}

I'll later try to compile the modified plugin on my machine. Is it hard? What do I need?

Ingwersaft commented 5 years ago

Not sure if you can replace build classpath libs. I meant: replace the whole wildfly-deploy-gradle-plugin with a locally compiled one. I'll add mavenLocal publishing to the project and info regarding local plugin build to the readme so collaboration will be easier :)

Ingwersaft commented 5 years ago

The readme now has a chapter about using locally build plugins.

aldonogueira commented 5 years ago

It worked!
I cloned, changed the dependency on build.gradle.kts to compile("org.wildfly.core", "wildfly-cli", "7.0.0.Final") and did a ./gradlew build. The jar was inside build/libs. Then I changed the build.gradle in my project to

buildscript {
    dependencies {
        ...
        classpath 'org.wildfly.core:wildfly-cli:7.0.0.Final'
        classpath files('/home/aldo/git/wildfly-deploy-gradle-plugin/build/libs/wildfly-deploy-gradle-plugin-0.2.9.jar')
    }
}

import com.mkring.wildlydeplyplugin.DeployWildflyTask
import com.mkring.wildlydeplyplugin.ExecuteWildflyTask

plugins {
    ...
    //id "com.mkring.wildlydeplyplugin.deploy-wildfly-plugin" version "0.2.9"
}

apply plugin: com.mkring.wildlydeplyplugin.DeployWildflyPlugin
...

Now the script prints

...
going to execute `run-batch`
result: true
response null
...

It seems the method you added to the README is better though

Ingwersaft commented 5 years ago

Nice! I'll check again if there is some possiblity to replace buildscript/plugin dependencies. I'd rather not maintain a branch for each target like I already do for jboss7...

aldonogueira commented 5 years ago

I don't really understand what you are talking about. :) Is there anything I can do to help?

Ingwersaft commented 5 years ago

Currently there are two banches, one for jboss7 (compile("org.jboss.as", "jboss-as-cli", "7.2.0.Final")) and the master one(compile("org.wildfly", "wildfly-cli", "8.2.1.Final")). Only difference is the used client cli jar. We found out that for your wildfly version (which one are you using by the way?), we need compile("org.wildfly.core", "wildfly-cli", "7.0.0.Final"). I'd prefer to not use branches for this, but I'm not sure if that is even possible.

aldonogueira commented 5 years ago

I understand. We are using WildFly Full 15.0.1.Final (WildFly Core 7.0.0.Final) according to the logs.

aldonogueira commented 5 years ago

We are running the commands using other methods now. I would like to see this issue solved for everyone, but the priority is lower for us now

Ingwersaft commented 5 years ago

I created another compatiblity branch for this (and released all branches) and a follow up issue for a better release process.