bmuschko / gradle-cargo-plugin Goto Github PK
View Code? Open in Web Editor NEWGradle plugin that provides deployment capabilities to local and remote containers via Cargo
License: Apache License 2.0
Gradle plugin that provides deployment capabilities to local and remote containers via Cargo
License: Apache License 2.0
Thanks a lot for your work.
Any way to specify a start/stop timeout?
https://docs.codehaus.org/display/CARGO/Container+Timeout
Thanks,
Nicolas
I am using cargo 0.5.2 and Grade 1.0 RC 3. I have the following simple configuration which I have in a file called cargo.gradle:
cargo {
containerId = 'tomcat7x'
port = 8080
deployable {
context = name
}
remote {
hostname = tomcat_hostname
username = tomcat_username
password = tomcat_password
}
}
In my build.gradle I have:
apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'maven'
apply plugin: 'cargo'
apply from: 'cargo.gradle'
But I get the error when I run the target cargoDeployRemote:
Task ':cargoDeployRemote' has not declared any outputs, assuming that it is out-of-date.
Deployable artifacts = [/Users/matt/WebService/build/libs/WebService-0.1-SNAPSHOT.war]
Container ID = tomcat7x
Starting action 'deploy' for remote container 'Tomcat 7.x' on 'http://10.1.1.100:8080'
[ant:taskdef] Could not load definitions from resource cargo.tasks. It could not be found.
FAILURE: Build failed with an exception.
-
What went wrong:
Execution failed for task ':cargoDeployRemote'.
Problem: failed to create task or type cargo
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any / declarations have taken place.
-
Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output.
BUILD FAILED
The error is confusing, is this a configuration problem on my side or something weird with the plugin?
my glassfish needs a database driver, which I was trying to add via configFile like that:
configFile {
file = file('mysql-driver.jar)
// see https://github.com/bmuschko/gradle-cargo-plugin/issues/18 (toDir = file("config") does not work)
toDir = new File("cargo-domain/lib")
}
however, the file ending up in my cargo-domain is twice as large as the original and it is not a valid jar file anymore.
Cargo does not recommend adding binary files using 'configFiles' (see https://docs.codehaus.org/display/CARGO/Configuration+files+option).
I've extended your plugin to support (binary) 'files' and I'd like to contribute that to your project. Can you give me directions how to do that?
Is it possible to support 'ArtifactInstaller' in the plugin as an extension to the current features?
From the cargo website:
"New versions of most application servers have their distribution packages built by Maven2, hence distribute these as ZIP or TAR.GZ files on a Maven2 repository. It is also rather easy to upload servers' packages to an internal (for example, enterprise) Maven repository. In this case, CARGO lets you directly use such artifacts using an ArtifactInstaller."
Thanks.
To make this much easier to use, would you consider pushing the artifacts and poms (with the right dependencies against cargo) to Sonatype which will then push into maven central.
I had an issue running the local embedded Jetty plugin, though Tomcat worked great. The issue surfaced as the following message when running any gradle command in the cargo-configured project:
Could not determine the dependencies of task ':cargoRunLocal'.
With --debug, I see this:
Caused by: groovy.lang.MissingMethodException: No signature of method: static org.gradle.api.plugins.cargo.property.CargoProjectProperty.getTypedProperty() is applicable for argument types: (org.gradle.api.internal.project.DefaultProject_Decorated, org.gradle.api.plugins.cargo.property.LocalJettyTaskProperty, null) values: [root project 'mgmt_ui', SESSION_PATH, null]
After poking around a bit, I noticed that LocalJettyTaskProperty does not implement TaskProperty, like the other *Property classes. After making this change I was able to get Jetty to work fine. I can make this change and submit a pull request if you like, but it's so minor I thought I'd start with an issue report.
Thanks!
Wow, This is a really useful plugin. I ran into a couple of limitations (or I just don't understand how to do what I need) and
I was wondering how easy it would be to extend the plugin to support the following:
I'm not even sure if #3 is supported in cargo today. I'd have to look. I just happen to notice the catalina.base system arg being passed and it points to temporary space. I was thinking it would be useful to possibly override that so that it goes somewhere into the project's buildDir. Alternatively, don't specify a separate catalina_base and just deploy directly to the catalina home dir specified in the convention object.
I'd have to get acclimated to git and the concept of forking the code and possibly resolving this issue myself. Probably not a bad thought, but it would take time.
Thanks so much for providing this plugin. Cheers.
Hi Benjamin,
We're running a local CI server (Jenkins/Gradle on Mac OS X) deploying to tomcat7x. We have a single CATALINA_HOME directory, but several CATALINA_BASE directories specifying seperate configs for local instances. Primarily, we use this to run instances for each type of CI build ("continuous" on port 8180, "nightly" on port 8280 and "stable" on port 8380), all on the same build server.
Unfortunately, because we can't use the Gradle Cargo plugin to specify our CATALINA_BASEs, only our CATALINA_HOME, we can't use server.xml to define these ports. This means we can't actually run multiple local instances of tomcat, as it kinda throws up on boot if it can't claim the ports it needs.
A workaround for this would be to expose the cargo.tomcat.ajp.port property in the cargo closure. Would this be possible?
Best wishes,
Dave @ Asdeq Labs
I need deploy to production and testing sever, they have different IP and hostname. How I can setup different tasks. If can deploy by git branch(production and develop branch) , will be better.
With this snippet
deployable {
file = file(buildDir + '/' + warFileName)
context = 'my'
}
Gradle is failing on the line:
file =
No signature of method: java.io.File.plus() is applicable for argument types: (java.lang.String) values: [/]
How do I build a dynamic file name ( from params passed into gradle -P) within the deployable closure. Is this broken?
Hi,
I'm not sure whether it is a cargo issue or cargo plugin issue, so please excuse my mistake if it is one.
I've got Tomcat 7 deployment configured, and after quite some time I managed to make it "work".
I'm trying to deploy grails application on tomcat. It has a dependency on postgres jar, which is added to tomcat/lib directory.
Unfortunately when using cargoStartLocal, this jar file is not loaded.
I've tried adding this jar as a dependency to my grails project, so the file is located in lib dir in war file, however this didn't help either.
What can I do to make it work?
Is there any way I could make cargo use tomcat directory and all the settings in it with lib directory as well?
Another thing I miss dearly is logging to catalina.out.
The cargo plugin places the actual config into the global temp folder like so:
${java.io.tmpdir}/cargo/conf
Is it possible to configure the conf dir somehow. I did not find a way so far. But in order to cleanup my project and to not interfere with other builds I would rather like to place it in a dir of my choice somewhere in the build dir.
Thanks,
David
Could you please add support for the new ear plugin.
If possible with a simple switch deployType=war/ear
to decide whether to take the output of the war or ear task.
And maybe a way to specify the deployment archive directly.
Hi Bmuschko I'm getting an container ID was not defined but when I run gradle without the cargo plugin the builds are successful. below is how I am referencing cargo in my script i'm completely lost in whats the problem.
apply plugin: 'cargo'
buildscript{
repositories{
mavenCentral();
}
dependencies{
classpath "org.gradle.api.plugins:gradle-cargo-plugin:0.6"
}
}
dependencies {
def cargoVersion='1.4.0'
cargo "org.codehaus.cargo:cargo-core-uberjar:$cargoVersion", "org.codehaus.cargo:cargo-ant:$cargoVersion"
}
cargo{
println "validating cargo"
//it.dependsOn "assemble"
containerId ="glassfish3x"
port=7001
deployable{
file = ear.outputs.files.singleFile
}
local{
//homeDir = new File("${jbosshome}")
homeDir = new File("D:/dev/servers/jboss-4.2.3.GA")
}
}
this is how i'm calling cargo in my script am I missing something?
My http response port is not 8080, it is something else. When I use the cargo plugin to deploy a war ( cargoDeployRemote ), it tries to upload via 8080 and does not read my configuration in the cargo {} closure
I have tried both:
cargo { port=19191 ... }
and also
cargo { remote { port=19191 ... } }
I use gradle with the --info option and in the log, I see this in both cases:
Starting action 'deploy' for remote container 'Tomcat 7.x' on 'http://myhost:8080'
It always tries to use 8080 irrespective of what I have in my cargo{}. If that is not the case, the info message is incorrect.
If this can be verified by someone, it would be greatly appreciated. I get a failure when executing the cargoDeployRemote plugin and when looking at the messages from info, there is a clear indication there either in the log or in reality that it is trying to use port 8080 and not the value passed in the closure. It may be hard coded in the gradle plugin but not sure.
Can the code be grep'd for "8080"? It's in there somewhere.
This documentation (and/or the plugin) is really confusing.
I still cannot deploy a war to a remote container.
There is a war{} closure, a remote {} closer, a deployable{} enclosure a local{} enclosure.
To deploy a war, the plugin would need to know:
and that's it.
I would not need a local{} closure I do not think because this is a war (local file) being pushed to a remote container.
I have a 'deployable' closure but I do not see params in the documentation to specify the host, ajp port or the login/user name in this deploy{} closure. I only see params to specify the 'file' and 'context'. HOW is the war deployed then?
In the documentation, the 'port' param states that this is the port the web app usually responds to like '8080' but this is useless information because a war is not deployed using this port, the ajp port is used.
What if I want to deploy a 3 wars to 3 different hosts all using different ajp ports, logins/passwords and different war files?
I would think I would create three deployable{} closures and put the parameters in there.
But having a remote{} closure outside of deployable{} is really confusing.
Please school me on how this is supposed to work, and if there is documentation that was left out can we get it in here please? I have wasted an entire freaking day trying to get started on gradle and get this working. very frustrating.
In addition if 'cargoUndeployRemote fails, there should be some way to continue, because maybe on a first call the webapp is not there but on a second call it is. The use case is if I want to write a script that will undeploy then deploy on each call but on the first go it would not fail if it does not exist (thereby not calling the deploy which is what I really need).
If there is any insight on this second issue, please let me know. I do not know how to determine if the webapp is there and conditionally call 'cargoUndeployRemote' in this case.
The current release of the gradle-cargo-plugin (v0.4) only accepts one deployable.
In maven it is possible with the cargo-maven2-plugin to deploy 3 different WAR-dependencies under different context on the same cargo/tomcat instance.
See relevant pom snippet below.
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>${cargo.version}</version>
<configuration>
<wait>false</wait>
<container>
<containerId>${cargo.container}</containerId>
<!-- Using the unzipped tomcat -->
<home>${project.build.directory}/install/${tomcat.artifactId}-${tomcat.version}</home>
</container>
<configuration>
<type>standalone</type>
<home>${project.build.directory}/${cargo.container}</home>
<properties>
<cargo.servlet.port>${cargo.port}</cargo.servlet.port>
<cargo.rmi.port>${cargo.rmi.port}</cargo.rmi.port>
<cargo.jvmargs>-XX:PermSize=512m -XX:MaxPermSize=1024</cargo.jvmargs>
</properties>
<deployables>
<deployable>
<groupId>my</groupId>
<artifactId>app1</artifactId>
<type>war</type>
<properties>
<context>/applicationOne</context>
</properties>
</deployable>
<deployable>
<groupId>my</groupId>
<artifactId>app2</artifactId>
<type>war</type>
<properties>
<context>/applicationTwo</context>
</properties>
</deployable>
<deployable>
<groupId>my</groupId>
<artifactId>anotherapp</artifactId>
<type>war</type>
<properties>
<context>/justanotherapp</context>
</properties>
</deployable>
</deployables>
</configuration>
</configuration>
<executions>
<execution>
<id>start-container</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>stop-container</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
The cargo task cargoRunLocal
works as expected, and just fine: server accessible at the appropriate address and port. The new tomcat instance's java process can be seen in the list of running processes, as expected.
However, cargoStartLocal
looks like it's doing the same thing, but as soon as the task is finished, it seems, the server is also killed and stops running.
We can't use cargoRunLocal
because we're running this from a Jenkins ci server -- we need the build to actually finish, and cargoRunLocal
, of course, doesn't stop. :)
Hi,
I'm new to gradle, coming from maven. The setup I'm looking for is the simplicity which I had in Maven (but there were other, more serious problems there): mvn jetty:run
That single command would build the war if needed, start the container and deploy.
I've tried adding dependsOn to cargoRunLocal but Gradle complains all the time about not finding the task or property.
Ideally I'd like to do something like this (I have a submodule called server):
server.cargoRunLocal.dependsOn('war')
server.cargoRunLocal.dependsOn('anyOtherTaskNeeded')
Am I thinking wrong or should this be possible?
A remote (tomcat7x) deployment fails with java.net.HttpRetryException: cannot retry due to proxy authentication, in streaming mode
.
According to this post is has to do with "chunked transfer encoding".
Full stack trace:
Caused by: : org.codehaus.cargo.container.ContainerException: Failed to deploy [...]
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:116)
at org.gradle.api.internal.project.ant.BasicAntBuilder.nodeCompleted(BasicAntBuilder.java:71)
at org.gradle.api.internal.project.ant.BasicAntBuilder.doInvokeMethod(BasicAntBuilder.java:86)
at org.gradle.api.internal.project.DefaultAntBuilder.super$3$invokeMethod(DefaultAntBuilder.groovy)
at org.gradle.api.internal.project.DefaultAntBuilder.invokeMethod(DefaultAntBuilder.groovy:37)
at org.gradle.api.plugins.cargo.RemoteContainerTask.runAction(RemoteContainerTask.groovy:37)
at org.gradle.api.plugins.cargo.AbstractContainerTask.start(AbstractContainerTask.groovy:48)
at org.gradle.api.internal.BeanDynamicObject$MetaClassAdapter.invokeMethod(BeanDynamicObject.java:216)
at org.gradle.api.internal.BeanDynamicObject.invokeMethod(BeanDynamicObject.java:122)
at org.gradle.api.internal.CompositeDynamicObject.invokeMethod(CompositeDynamicObject.java:147)
at org.gradle.api.plugins.cargo.RemoteContainerTask_Decorated.invokeMethod(Unknown Source)
at org.gradle.util.ReflectionUtil.invoke(ReflectionUtil.groovy:23)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$4.execute(AnnotationProcessingTaskFactory.java:161)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$4.execute(AnnotationProcessingTaskFactory.java:156)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:472)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:461)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:60)
... 58 more
Caused by: org.codehaus.cargo.container.ContainerException: Failed to deploy [...war]
at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.deploy(AbstractTomcatManagerDeployer.java:110)
at org.codehaus.cargo.ant.CargoTask.executeActions(CargoTask.java:594)
at org.codehaus.cargo.ant.CargoTask.execute(CargoTask.java:531)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
... 74 more
Caused by: java.net.HttpRetryException: cannot retry due to proxy authentication, in streaming mode
at org.codehaus.cargo.container.tomcat.internal.TomcatManager.invoke(TomcatManager.java:507)
at org.codehaus.cargo.container.tomcat.internal.TomcatManager.deployImpl(TomcatManager.java:569)
at org.codehaus.cargo.container.tomcat.internal.TomcatManager.deploy(TomcatManager.java:273)
at org.codehaus.cargo.container.tomcat.internal.TomcatManager.deploy(TomcatManager.java:256)
at org.codehaus.cargo.container.tomcat.internal.TomcatManager.deploy(TomcatManager.java:240)
at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.deploy(AbstractTomcatManagerDeployer.java:102)
... 78 more
If I specify configuration file for local tomcat as following:
local {
....
configFile {
file = file('relative/path/in/project.ext')
toDir = file('somePath')
}
}
On cargoRunLocal the specified configuration file is copied to location:
/tmp/cargo/conf/<absolute path to project's working dir>/somePath/file.ext
(for example in my case "/tmp/cargo/conf/home/petr/work/project/somePath/file.ext")
I see no way to specify target path that would be relative to target installation directory.
Expected: for configuration above file should be copied to
/tmp/cargo/conf/somePath/file.ext
When I execute the cargoDeployRemote task in the cargo plugin, I get this error message:
Deprecated dynamic property: "context" on "root project 'gradle'", value: "hello". FAILURE: Build failed with an exception. * Where: Build file '/home/project/myproj/trunk/src/main/gradle/deployWar.gradle' line: 118 * What went wrong: A problem occurred evaluating root project 'gradle'. > Neither path nor baseDir may be null or empty string. path='' basedir='/home/project/myproj/trunk/src/main/gradle' * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. BUILD FAILED Total time: 7.11 secs
Where do I set path & basedDir (as params to some closure), is there any additional documentation ( have a deadline ). Why is it complaining about path and baseDir?
Here is my.gradle (anything wrong here?)
cargo {
containerId = 'tomcat7x'
port=port
deployable {
file = file(warFileName)
context = web_context
}
remote { // all these params here and above passed in with -Pscheme=http etc.
protocol=scheme
hostname=host
username=login
password=password
}
}
I am passing in all params on the gradle command line with -Phost= and so on. Any help would be greatly appreciated here, stuck here.
I am attempting to write a task to deploy a .war file based on input params (not a war file built in the project).
Hello,
Using the following build.gradle file -
apply plugin: 'cargo'
repositories {
mavenCentral()
}
buildscript {
repositories {
add(new org.apache.ivy.plugins.resolver.URLResolver()) {
name = 'GitHub'
addArtifactPattern 'http://cloud.github.com/downloads/[organisation]/[module]/[module]-[revision].[ext]'
}
}
dependencies {
classpath 'bmuschko:gradle-cargo-plugin:0.3'
}
}
cargo {
containerId = 'tomcat6x'
port = 8080
context = "mycontext"
remote {
hostname = "192.168.1.101"
username = "tomcat"
password = "tomcat"
}
}
dependencies {
providedCompile 'javax.servlet:servlet-api:2.5'
cargo 'org.codehaus.cargo:cargo-core-uberjar:1.1.1',
'org.codehaus.cargo:cargo-ant:1.1.1',
'jaxen:jaxen:1.1.1'
}
I'm unable to execute the gradle tasks command.
I recieve an error stating that the Plugin with id 'cargo' cannot be found.
I'm using gradle version 1.2
Any ideas?
Thank you,
-Zach
Hello, there.
I'm wagering that this isn't an issue with the Cargo Gradle plugin itself; but I'm having difficulty with a minimal task test with the plugin, and I was hoping for some help.
I'm using the following build.gradle:
apply plugin: 'war'
apply plugin: 'cargo'
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.gradle.api.plugins:gradle-cargo-plugin:0.5.8'
}
}
dependencies {
def cargoVersion = '1.3.3'
cargo "org.codehaus.cargo:cargo-core-uberjar:$cargoVersion",
"org.codehaus.cargo:cargo-ant:$cargoVersion"
}
cargo {
containerId = 'tomcat6x'
port = 9090
deployable {
context = 'myawesomewebapp'
}
remote {
hostname = 'localhost'
username = 'superuser'
password = 'secretpwd'
}
}
And the output for any Cargo-related task seems to be:
(~/Development/WebDevelopment/repositories/git/courseGuideResources){dispader}02:36pm] gradle cargoRunLocal
:cargoRunLocal
FAILURE: Build failed with an exception.
* What went wrong:
Could not resolve all dependencies for configuration ':cargo'.
> Could not find group:org.codehaus.cargo, module:cargo-core-uberjar, version:1.3.3.
Required by:
:courseGuideResources:unspecified
> Could not find group:org.codehaus.cargo, module:cargo-ant, version:1.3.3.
Required by:
:courseGuideResources:unspecified
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 5.148 secs
So it appears to me that I'm having troubles resolving the Cargo core itself; but I'm at a loss for what might be missing from build.gradle in this case.
Thank you much for your time and attention.
Jake
Hi Guys
I want to deploy my application to the JBoss AS? Does this plugin support it?
Best Regards
Shining
Hi, I am trying to deploy a war to multiple tomcat remote containers. But, it seems like it is only picking up the last remote declaration. Is this a known issue, as designed or error on my part?
Here is the cargo section in my gradle script:
cargo {
containerId = 'tomcat7x'
deployable {
file = war.archivePath
context = 'dev'
}
remote {
hostname = 'services-dev-02.hwp.org'
port = 8080
username = 'tomcat'
password = 'xyz'
}
remote {
hostname = 'services-dev-01.hwp.org'
port = 8080
username = 'tomcat'
password = 'xyz'
}
}
thanks for your help.
I have googled but the only thing I have found is the source code of Container.groovy which mentions oc4j in an enum. I have also seen CargoLocalTaskConvention.groovy but it doesn't seems to have anything related with oc4j.
How can I deploy to an oc4j container? here is the gradle.build of the project I want to deploy:
/**
* Viewcontroller
*/
apply plugin: 'war'
apply plugin: 'cargo'
dependencies {
compile 'com.lowagie:itext:2.1.0@jar'
// Another dependencies here... blah blah blah...
def cargoVersion = '+'
cargo "org.codehaus.cargo:cargo-core-uberjar:$cargoVersion",
"org.codehaus.cargo:cargo-ant:$cargoVersion"
}
cargo {
containerId = 'oc4j10x'
port = 8888
/*
deployable {
context = ':viewcontroller'
}
remote {
hostname = 'cloud.internal.it'
username = 'superuser'
password = 'secretpwd'
}
*/
local {
homeDir = file('/media/jonatan/FEB4C76AB4C7244D/ias/oc4j_extended_101350')
//output = file('build/output.log')
}
}
This is the build.gradle of my multi-project configuration:
/**
* Workspace
*/
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.gradle.api.plugins:gradle-cargo-plugin:+'
}
}
subprojects {
apply plugin: 'java'
apply plugin: 'pmd'
apply plugin: 'eclipse'
compileJava.options.encoding = 'ISO-8859-1'
sourceCompatibility = 1.5
targetCompatibility = 1.5
repositories {
mavenCentral()
}
dependencies {
testCompile 'junit:junit:4.+'
}
pmd {
ignoreFailures = true
}
}
This is what I get when running gradle cargoStartLocal
gradle cargoStartLocal
:viewcontroller:cargoStartLocal
org.codehaus.cargo.container.ContainerException: Failed to create a OC4J 10.x existing configuration
:viewcontroller:cargoStartLocal FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':viewcontroller:cargoStartLocal'.
> org.codehaus.cargo.container.ContainerException: Failed to create a OC4J 10.x existing configuration
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 3.784 secs
Could you please add support for Wildfly 8.x and JBoss 7.2.x.
They are both supported by Cargo.
I got several tomcat 7 instances under nginx on the front. To use deploy with their manager app, I got to use different url for each one.
As you see there is no choise but to change default url for manager app, which is
http://hostname:port/manager/text
Cargo itself allow this through property cargo.remote.uri. But CargoRemoteTaskConvention class has no such field. So as I understand there is no ability to change url, like I need in my case
Gradle fails with NPE if cargo.containerId is not defined
The culprit is line 236 in CargoPlugin.groovy that is passing null to LocalContainerTaskMapping.getLocalContainerTaskMappingForContainerId causing an NPE in the TreeMap lookup.
This should be handled without an exception and a warning should be issued that cargo was not configured correctly.
When trying to deploy remote to a glassfish server the admin port is always 4848.
Tried using port, portadmin and servletport properties with no luck. When debug i noted that
always is connecting to port 4848 doesnt matter what you put on the gradle config.
If I add the webappsDir directory, the deployable is not getting effected. Only the webapps already present in the directory are available. If I don't add the webappsDir
property, everything works fine. I need to have the deployable from the current project to work in tandem with the existing wars in the existing directory.
tomcat {
webappsDir = file('/Users/prasanna/Documents/learn/cr-ess-1/build/libs/webapps')
ajpPort = 8009
}
I added copyWars=true
as well, to no effect. Am I doing it right?
I want to use the plugin with jetty 9. Here's my build.gradle:
apply plugin: 'war'
apply plugin: 'cargo'
dependencies {
compile("org.springframework:spring-messaging:${springVersion}")
compile("org.springframework:spring-websocket:${springVersion}")
compile("org.springframework:spring-webmvc:${springVersion}")
compile("org.projectreactor:reactor-tcp:1.0.0.M1")
providedCompile("javax.servlet:javax.servlet-api:3.1.0")
def cargoVersion = '1.3.3'
cargo "org.codehaus.cargo:cargo-core-uberjar:$cargoVersion",
"org.codehaus.cargo:cargo-ant:$cargoVersion"
}
buildscript {
repositories { mavenCentral() }
dependencies { classpath 'org.gradle.api.plugins:gradle-cargo-plugin:0.6.1' }
}
cargo {
containerId = 'jetty9x'
port = 8080
}
Executing gradle cargoRunLocal produces the following output:
:merkur-server:cargoRunLocal FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':merkur-server:cargoRunLocal'.
> Cannot get property 'canonicalPath' on null object
* Try:
Run with --debug option to get more log output.
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':merkur-server:cargoRunLocal'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
at org.gradle.api.internal.changedetection.state.CacheLockReleasingTaskExecuter$1.run(CacheLockReleasingTaskExecuter.java:35)
at org.gradle.internal.Factories$1.create(Factories.java:22)
at org.gradle.cache.internal.DefaultCacheAccess.longRunningOperation(DefaultCacheAccess.java:179)
at org.gradle.cache.internal.DefaultCacheAccess.longRunningOperation(DefaultCacheAccess.java:232)
at org.gradle.cache.internal.DefaultPersistentDirectoryStore.longRunningOperation(DefaultPersistentDirectoryStore.java:142)
at org.gradle.api.internal.changedetection.state.DefaultTaskArtifactStateCacheAccess.longRunningOperation(DefaultTaskArtifactStateCacheAccess.java:83)
at org.gradle.api.internal.changedetection.state.CacheLockReleasingTaskExecuter.execute(CacheLockReleasingTaskExecuter.java:33)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:58)
at org.gradle.api.internal.tasks.execution.ContextualisingTaskExecuter.execute(ContextualisingTaskExecuter.java:34)
at org.gradle.api.internal.changedetection.state.CacheLockAcquiringTaskExecuter$1.run(CacheLockAcquiringTaskExecuter.java:39)
at org.gradle.internal.Factories$1.create(Factories.java:22)
at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:124)
at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:112)
at org.gradle.cache.internal.DefaultPersistentDirectoryStore.useCache(DefaultPersistentDirectoryStore.java:134)
at org.gradle.api.internal.changedetection.state.DefaultTaskArtifactStateCacheAccess.useCache(DefaultTaskArtifactStateCacheAccess.java:79)
at org.gradle.api.internal.changedetection.state.CacheLockAcquiringTaskExecuter.execute(CacheLockAcquiringTaskExecuter.java:37)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:57)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:41)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:51)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:52)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:42)
at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:282)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.executeTask(DefaultTaskPlanExecutor.java:48)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.processTask(DefaultTaskPlanExecutor.java:34)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:27)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:89)
at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:29)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)
at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67)
at org.gradle.api.internal.changedetection.state.TaskCacheLockHandlingBuildExecuter$1.run(TaskCacheLockHandlingBuildExecuter.java:31)
at org.gradle.internal.Factories$1.create(Factories.java:22)
at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:124)
at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:112)
at org.gradle.cache.internal.DefaultPersistentDirectoryStore.useCache(DefaultPersistentDirectoryStore.java:134)
at org.gradle.api.internal.changedetection.state.DefaultTaskArtifactStateCacheAccess.useCache(DefaultTaskArtifactStateCacheAccess.java:79)
at org.gradle.api.internal.changedetection.state.TaskCacheLockHandlingBuildExecuter.execute(TaskCacheLockHandlingBuildExecuter.java:29)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)
at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67)
at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:54)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:166)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:113)
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:81)
at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:64)
at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:33)
at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:24)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:35)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26)
at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:50)
at org.gradle.api.internal.Actions$RunnableActionAdapter.execute(Actions.java:171)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:201)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:174)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:170)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:139)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
at org.gradle.launcher.Main.doAction(Main.java:48)
at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
at org.gradle.launcher.Main.main(Main.java:39)
at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:50)
at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:32)
at org.gradle.launcher.GradleMain.main(GradleMain.java:26)
Caused by: java.lang.NullPointerException: Cannot get property 'canonicalPath' on null object
at org.gradle.api.plugins.cargo.LocalContainerTask.getCargoAttributes(LocalContainerTask.groovy:144)
at org.gradle.api.plugins.cargo.LocalContainerTask.runAction(LocalContainerTask.groovy:85)
at org.gradle.api.plugins.cargo.AbstractContainerTask$_start_closure1.doCall(AbstractContainerTask.groovy:49)
at org.gradle.api.plugins.cargo.AbstractContainerTask$_start_closure1.doCall(AbstractContainerTask.groovy)
at org.gradle.api.plugins.cargo.util.LoggingHandler.withAntLoggingListener(LoggingHandler.groovy:38)
at org.gradle.api.plugins.cargo.util.LoggingHandler$withAntLoggingListener.call(Unknown Source)
at org.gradle.api.plugins.cargo.AbstractContainerTask.start(AbstractContainerTask.groovy:48)
at org.gradle.api.internal.BeanDynamicObject$MetaClassAdapter.invokeMethod(BeanDynamicObject.java:216)
at org.gradle.api.internal.BeanDynamicObject.invokeMethod(BeanDynamicObject.java:122)
at org.gradle.api.internal.CompositeDynamicObject.invokeMethod(CompositeDynamicObject.java:147)
at org.gradle.api.plugins.cargo.LocalJettyTask_Decorated.invokeMethod(Unknown Source)
at org.gradle.util.ReflectionUtil.invoke(ReflectionUtil.groovy:23)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.doExecute(AnnotationProcessingTaskFactory.java:217)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:210)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:199)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:526)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:509)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
... 67 more
BUILD FAILED
Total time: 6.073 secs
Can you give me a hint on how to fix this?
Hi!
I'm trying to deploy a project to a JBoss AS7 (version 7.1.1-Final, running on localhost:8090) using this plugin but so far it's not working. Here's my build.gradle file:
apply plugin: 'cargo'
repositories {
mavenCentral()
}
dependencies {
def cargoVersion = '1.3.3'
cargo "org.codehaus.cargo:cargo-core-uberjar:$cargoVersion",
"org.codehaus.cargo:cargo-ant:$cargoVersion"
}
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.gradle.api.plugins:gradle-cargo-plugin:0.6'
}
}
cargo {
containerId = 'jboss71x'
port = 8090
remote {
hostname = 'localhost'
}
}
Running gradle cargoDeployRemote -info
gives me some information, including this:
Selected primary task 'cargoDeployRemote'
Tasks to be executed: [task ':cargoDeployRemote']
:cargoDeployRemote
Task ':cargoDeployRemote' has not declared any outputs, assuming that it is out-of-date.
:: loading settings :: url = jar:file:/real/path/to/gradle-1.5/lib/ivy-2.2.0.jar!/org/apache/ivy/core/settings/ivysettings.xml
Container ID = jboss71x
:cargoDeployRemote FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':cargoDeployRemote'.
> Cannot get property 'canonicalPath' on null object
I tried adding a username and password (though other programs that deploy to JBoss don't need them). As far as I understand, local JBoss servers are not currently supported by cargo so that's not an option.
Any ideas on why it's not working?
My company is pretty strict regarding adding 3rd party jars.
Most gradle plugins seem to have dependencies but they are in the buildscript closure. For these plugins, I allow a plugin to access mavenCentral within this buildscript closure but still lock down the rest of my gradle script to only allow dependencies that are in our company's internal maven repo.
However, for cargo, there are dependencies needed outside of the buildscript closure. Is this completely necessary? Is there a workaround? One thing I could do is limit cargo configuration dependencies to access repositories that other configurations (e.g. runtime) do not have access to, but I have no idea if this is possible or not.
I realize this issue probably goes beyond the scope of your plugin, but I thought I'd start here.
Thanks.
Hi Guys
I want to use jetty as my local container, and I used jetty gradle plugin to do this , I used the embed Jetty, So I dn't know where the home_dir is? Could you give me some suggestions to configure this? Thanks!
Best Regards
Shining
Hello,
I'm trying to deploy an EAR file to Weblogic 10.3.x.
This is the relevant configuration:
cargo {
containerId = 'weblogic103x'
port = 7001
local {
homeDir = file(/Users/xyz//tools/wls1036_dev/wlserver/')
weblogic {
adminUser='weblogic'
adminPassword='weblogic'
beaHome = file('/Users/xyz/tools/wls1036_dev/')
server ='AdminServer'
}
}
}
The script should be properly configured because I'm able to shut down a running container by using gradle cargoStopLocal
I don't understand how to deploy to the local container though.
Both cargoRunLocal
and cargoStartLocal
hangs until timeout is reached. It seems that they constantly execute a GET
against an invalid url - /cargocpc/index.html
I would have expected a deploy
task available for local servers, similarly to the Maven plugin.
Thanks
Luciano
We have the need to stop/start the container with a custom script after deploying a .war, how can this be accomplished?
If this is not possible, can this feature be added? Can I be pointed in the right direction as to how to do this (or another plugin to use?).
This is for deployment of a tomcat .war. I tried using the Tomcat plugin but so far have not had success.
As far as I can tell I've followed the instructions for making this work. The "cargoStartLocal" task runs without any exceptions from the command line. Yet nothing happens with my local tomcat container - it doesn't start, and no application is deployed to it. Perhaps I'm doing something wrong? Here's my relevant configuration:
cargo.container.id=tomcat6x
cargo.home.dir=C:/Program Files/Apache Software Foundation/Tomcat 6.0
datasource=localhost
buildscript {
repositories {
add(new org.apache.ivy.plugins.resolver.URLResolver()) {
name = 'GitHub'
addArtifactPattern 'http://cloud.github.com/downloads/bmuschko/gradle-cargo-plugin/[module]-[revision].[ext]'
}
mavenCentral()
}
dependencies {
classpath ':gradle-cargo-plugin:0.2'
}
}
subprojects {
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'maven'
sourceCompatibility = 1.5
def localMavenRepo = new File(localMavenRepo).toURL().toString()
repositories {
mavenRepo urls: localMavenRepo
mavenCentral()
mavenRepo(urls: 'http://download.java.net/maven/glassfish')
mavenRepo(urls: 'https://repository.jboss.org/nexus/content/groups/public/')
mavenRepo(urls: 'http://download.eclipse.org/jgit/maven')
}
}
project(':app:DPU2') {
apply plugin: 'war'
apply plugin: 'cargo'
version = 2.0
task copyDatasource(type: Copy) {//copy our <datasource>.xml into dpu-datasource.xml
from('src/main/webapp/WEB-INF/datasource/')
into('src/main/webapp/WEB-INF/')
include(datasource + '.xml')
rename(datasource + '.xml', 'dpu-datasource.xml')
}
war {
dependsOn(':app:DPU2:copyDatasource')
exclude 'WEB-INF/datasource/*'
baseName = 'dpu2'
}
dependencies {
compile project(':api:core')
compile project(':api:intellispec')
providedRuntime 'javax.servlet:servlet-api:2.5@jar'
providedRuntime 'javax.servlet:jsp-api:2.0@jar'
providedRuntime 'mysql:mysql-connector-java:5.1.13@jar'
runtime 'opensymphony:sitemesh:2.4.2'
runtime 'com.sun.jmx:jmxri:1.2.1'
runtime 'org.slf4j:slf4j-log4j12:1.5.6'
runtime 'org.springframework.security:spring-security-taglibs:2.0.5.RELEASE'
runtime 'javax.servlet.jsp.jstl:jstl-api:1.2@jar'
runtime 'taglibs:standard:1.1.2'
runtime 'commons-lang:commons-lang:2.4'
runtime 'commons-fileupload:commons-fileupload:1.2.1'
runtime 'jaxen:jaxen:1.1.1@jar'
runtime 'xom:xom:1.0@jar'
runtime 'xml-apis:xml-apis:1.3.02'
runtime 'net.sf.spring-json:spring-json:1.2'
runtime 'commons-dbcp:commons-dbcp:1.3'
compile 'org.apache.geronimo.specs:geronimo-jta_1.1_spec:1.1'
compile 'org.hibernate:hibernate-annotations:3.4.0.GA'
compile 'org.springframework:spring:2.5.6.SEC01'
compile 'org.springframework:spring-webmvc:2.5.6'
compile 'org.springframework.ldap:spring-ldap-core:1.3.0.RELEASE'
compile 'org.springframework.security:spring-security-core:2.0.5.RELEASE'
cargo "org.codehaus.cargo:cargo-core-uberjar:$cargoVersion",
"org.codehaus.cargo:cargo-ant:$cargoVersion"
}
}
CargoPlugin.groovy:226's configureLocalContainer() contains a project.afterEvaluate block that will execute regardless of whether such an exception is thrown. In this block, an exception is thrown if containerId is not set on the cargo closure. This leads to a problem if an exception is thrown in build.gradle before the 'cargo' closure is evaluated, because the cargo closure will not have containerId set.
The result is that if an exception is thrown before the cargo closure is evaluated, that exception will not be surfaced to the user. Instead, cargo plugin's exception will be shown:
<snip>
:buildSrc:check UP-TO-DATE
:buildSrc:build UP-TO-DATE
Container ID was not defined.
org.gradle.api.InvalidUserDataException: Container ID was not defined.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77)
at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:102)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:190)
at org.gradle.api.plugins.cargo.CargoPlugin$_configureLocalContainer_closure10.doCall(CargoPlugin.groovy:229)
<snip>
I have solved this problem on my own branch by wrapping the afterEvaluate callback with the following:
project.afterEvaluate { proj, state ->
if(state.getFailure() == null) {
Would this be an acceptable pull request? Thanks!
What am I doing wrong ?
When I run my gradle build
def TOMCAT_URL = "http://apache.mirror.iphh.net/tomcat/tomcat-6/v6.0.36/bin/apache-tomcat-6.0.36.zip"
apply plugin: 'cargo'
dependencies {
def CARGO = '1.3.1'
classpath "org.codehaus.cargo:cargo-core-uberjar:$CARGO",
"org.codehaus.cargo:cargo-ant:$CARGO"
}
cargo {
containerId = 'tomcat6x'
port = 8090
deployable {
file = file('xxxx.war')
context = 'xxxx'
}
local {
installer {
installUrl = TOMCAT_URL
downloadDir = file("$projectDir/download")
extractDir = file("$buildDir/extract")
}
output = file('build/output.log')
}
}
I got the error message
Container ID was not defined.
org.gradle.api.InvalidUserDataException: Container ID was not defined.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77)
at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:102)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:190)
at org.gradle.api.plugins.cargo.CargoPlugin$_configureLocalContainer_closure10.doCall(CargoPlugin.groovy:229)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:272)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:877)
at groovy.lang.Closure.call(Closure.java:412)
at org.gradle.listener.BroadcastDispatch$ClosureInvocationHandler.dispatch(BroadcastDispatch.java:116)
at org.gradle.listener.BroadcastDispatch$ClosureInvocationHandler.dispatch(BroadcastDispatch.java:101)
at org.gradle.listener.BroadcastDispatch.dispatch(BroadcastDispatch.java:88)
at org.gradle.listener.BroadcastDispatch.dispatch(BroadcastDispatch.java:32)
at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
at $Proxy10.afterEvaluate(Unknown Source)
at org.gradle.configuration.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:47)
at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:463)
at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:75)
at org.gradle.configuration.ProjectEvaluationConfigurer.execute(ProjectEvaluationConfigurer.java:23)
at org.gradle.configuration.ProjectEvaluationConfigurer.execute(ProjectEvaluationConfigurer.java:21)
at org.gradle.api.internal.Actions$CompositeAction.execute(Actions.java:67)
at org.gradle.api.internal.Actions$TransformingActionAdapter.execute(Actions.java:96)
at org.gradle.api.internal.project.AbstractProject.configure(AbstractProject.java:439)
at org.gradle.api.internal.project.AbstractProject.allprojects(AbstractProject.java:434)
at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:32)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:142)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:113)
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:81)
at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:38)
at org.gradle.launcher.exec.InProcessGradleLauncherActionExecuter.execute(InProcessGradleLauncherActionExecuter.java:39)
at org.gradle.launcher.exec.InProcessGradleLauncherActionExecuter.execute(InProcessGradleLauncherActionExecuter.java:25)
at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:50)
at org.gradle.api.internal.Actions$RunnableActionAdapter.execute(Actions.java:137)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:201)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:174)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:170)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:139)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
at org.gradle.launcher.Main.doAction(Main.java:48)
at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
at org.gradle.launcher.Main.main(Main.java:39)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:50)
at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:32)
at org.gradle.launcher.GradleMain.main(GradleMain.java:26)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:33)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:130)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:48)
Container ID was not defined.
org.gradle.api.InvalidUserDataException: Container ID was not defined.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77)
at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:102)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:190)
at org.gradle.api.plugins.cargo.CargoPlugin$_configureLocalContainer_closure10.doCall(CargoPlugin.groovy:229)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:272)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:877)
at groovy.lang.Closure.call(Closure.java:412)
at org.gradle.listener.BroadcastDispatch$ClosureInvocationHandler.dispatch(BroadcastDispatch.java:116)
at org.gradle.listener.BroadcastDispatch$ClosureInvocationHandler.dispatch(BroadcastDispatch.java:101)
at org.gradle.listener.BroadcastDispatch.dispatch(BroadcastDispatch.java:88)
at org.gradle.listener.BroadcastDispatch.dispatch(BroadcastDispatch.java:32)
at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
at $Proxy10.afterEvaluate(Unknown Source)
at org.gradle.configuration.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:47)
at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:463)
at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:75)
at org.gradle.configuration.ProjectEvaluationConfigurer.execute(ProjectEvaluationConfigurer.java:23)
at org.gradle.configuration.ProjectEvaluationConfigurer.execute(ProjectEvaluationConfigurer.java:21)
at org.gradle.api.internal.Actions$CompositeAction.execute(Actions.java:67)
at org.gradle.api.internal.Actions$TransformingActionAdapter.execute(Actions.java:96)
at org.gradle.api.internal.project.AbstractProject.configure(AbstractProject.java:439)
at org.gradle.api.internal.project.AbstractProject.allprojects(AbstractProject.java:434)
at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:32)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:142)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:113)
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:81)
at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:38)
at org.gradle.launcher.exec.InProcessGradleLauncherActionExecuter.execute(InProcessGradleLauncherActionExecuter.java:39)
at org.gradle.launcher.exec.InProcessGradleLauncherActionExecuter.execute(InProcessGradleLauncherActionExecuter.java:25)
at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:50)
at org.gradle.api.internal.Actions$RunnableActionAdapter.execute(Actions.java:137)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:201)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:174)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:170)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:139)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
at org.gradle.launcher.Main.doAction(Main.java:48)
at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
at org.gradle.launcher.Main.main(Main.java:39)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:50)
at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:32)
at org.gradle.launcher.GradleMain.main(GradleMain.java:26)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:33)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:130)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:48)
FAILURE: Build failed with an exception.
* What went wrong:
Container ID was not defined.
Hi,
to run more than one tomcat i have to set the rmi port.
Unfortunately this is not possible with the current version.
See http://docs.codehaus.org/display/CARGO/Configuration+properties
Cheers
Cengiz
I'd like to extend the provided tasks to perform some additional tasks and to switch destination deployment containers. For example, I've got both test and staging options. One approach is to exec your tasks from inside another task, but it would be neater like this:
project.ext.testCargo = cargo {
containerId = 'tomcat7x'
remote {
hostname = '10.0.1.1'
username = 'deploy'
password = tomcatStagingPass // this comes from ~/.gradle/gradle.properties
}
}
task deployTest (dependsOn: war, type:RemoteContainerTask) {
with testCargo
doLast {
// send some email or do something else
}
}
But I'm stuck at "type:RemoteContainerTask". Any thoughts about how we could extend your tasks in this way? This would give us huge flexibility.
Hi,
I am having trouble to deploy my war locally. Here is a snippet of my build.gradle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.gradle.api.plugins:gradle-cargo-plugin:0.5.9'
}
}
cargo {
containerId = 'tomcat6x'
port = 8084
deployable {
file = file('build/libs/app.war')
context = 'app'
}
local {
homeDir = file('C:/dev/bin/Apache Software Foundation/Apache Tomcat 6.0.35')
output = file('build/output.log')
tomcat {
webappsDir = file('build/libs')
copyWars = 'true'
ajpPort = 9091
}
}
}
and here is the relevant end of the exception thrown when I run gradle cargoStartLocal
Caused by: org.codehaus.cargo.container.ContainerException: Failed to create a Tomcat 6.x container configuration
at org.codehaus.cargo.container.tomcat.internal.AbstractCatalinaStandaloneLocalConfiguration.setupWebApps(AbstractCatalinaStandaloneLocalConfiguration.j
ava:243)
at org.codehaus.cargo.container.tomcat.internal.AbstractCatalinaStandaloneLocalConfiguration.doConfigure(AbstractCatalinaStandaloneLocalConfiguration.ja
va:154)
at org.codehaus.cargo.container.spi.configuration.AbstractLocalConfiguration.configure(AbstractLocalConfiguration.java:210)
... 80 more
Caused by: org.codehaus.cargo.util.CargoException: Failed to create folders for path [C:\Users\tomas\AppData\Local\Temp\cargo\conf\C:\dev\data\personal\myproject\build\libs]
at org.codehaus.cargo.util.DefaultFileHandler.mkdirs(DefaultFileHandler.java:670)
at org.codehaus.cargo.util.DefaultFileHandler.createDirectory(DefaultFileHandler.java:297)
at org.codehaus.cargo.container.tomcat.internal.AbstractCatalinaStandaloneLocalConfiguration.setupWebApps(AbstractCatalinaStandaloneLocalConfiguration.j
ava:226)
... 82 more
It looks like DefaultFileHandler is trying to build wrong path C:\Users\tomas\AppData\Local\Temp\cargo\conf\C:\dev\data\personal\myproject\build\libs
. I bet I have missed some configuration and it is silly mistake but I can't see it.
Any help would by much appreciated.
Thanks
Tomas
It is not clear in the documentation how to specify the .war file to be deployed. It is assuming a default of the name of the directory I am in dot war. If I have a directory called 'app', it is trying to deploy '../app/build/libs/app.war', but that is not the name of the .war file that I wish to deploy.
I want to deply a .war file from my /target/ directory with a version number on it like '.../app/target/app-1.0.0.war'
There must be a closure to specify the warfile name (using a variable based on a version number?
This is a gradle deploy script for a maven built war. Eventually we may move over to gradle for the build, but for now we simply need to deploy the .war.
Hello Benjamin,
thanks for your work for providing a cargo plugin for gradle.
I encountered a problem when remote deploying a web archive to JBoss AS 7.1.1.FINAL.
My JBoss is configured with a port offset of 1000. (
my configuration in gradle is:
cargo {
containerId = 'jboss71x'
port = '10999'
remote {
hostname = '....'
username = '....'
password = '...'
}
}
Calling cargoDeployRemote will fail with a java.net.ConnectException. Could not connect to remote://host:9999.
Is it possible to extend your plugin with a portOffset Option for JBoss?
Or is it possible to provide a mechanism to define custom cargo properties from gradle? I think this would be a flexible way of giving the user to customize the properties set by your plugin.
Kind regards,
Georg
I implemented the Cargo plugin in my Gradle plugin and got it to work, following the documentation here. There is one problem though: I configured my log directory to be "$buildDir/cargo/cargo.log", and after a clean build cargoRunLocal fails to create that file. When I manually create the directory "$buildDir/cargo" is works. To fix this, I tried to enhance the task like this:
cargoRunLocal.doFirst {
mkdir "$buildDir/cargo"
}
However, then my build always fails with
Could not find property 'cargoRunLocal' on project ':ur2-webapp'.
When I replace 'cargoRunLocal' in the above with 'build' or 'war', everything works and the directory is created. That's why I think the problem might be with the Gradle Cargo plugin.
hi,
thx for the work! We use cargo to redeploy a remote tomcat during a jenkins build. Since we have issues with hotdeployment on tomcat (memory problems) we would like to start/stop/deploy/start the remote container.
AFAIK there is no way to do this with the gradle plugin?
I'm having this error when undeploying my webapp
What went wrong:
Execution failed for task ':cargoUndeployRemote'.
Deployable /work/workspaces/(...)xpto.war does not existCaused by: org.gradle.api.InvalidUserDataException: Deployable /work/workspaces/(...)xpto.war does not exist
at org.gradle.api.plugins.cargo.AbstractContainerTask$_validateConfiguration_closure1.doCall(AbstractContainerTask.groovy:59)
at org.gradle.api.plugins.cargo.AbstractContainerTask.validateConfiguration(AbstractContainerTask.groovy:56)
at org.gradle.api.plugins.cargo.AbstractContainerTask.start(AbstractContainerTask.groovy:47)
at org.gradle.api.internal.BeanDynamicObject$MetaClassAdapter.invokeMethod(BeanDynamicObject.java:216)
I understand what is happening. The thing is, it is really necessary to provide a .war to undeploy something from a tomcat server? I should only need the context to undeploy, right?
I'm using the gradle-cargo-plugin in combination with jboss 7.1 (containerId = 'jboss71x')
Works great for deployments and so on, but as far as I can see, there is no way for to configure configfiles in the current version of the plugin.
From the cargo website:
"The configuration files are the files to add to your container's configuration. It is internally used by some containers and is accessible for you can to add extra files."
For example, to copy another standalone.xml file into the jboss7 configuration folder
Thanks in advance !
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.