bmuschko / gradle-cargo-plugin

Gradle plugin that provides deployment capabilities to local and remote containers via Cargo
Apache License 2.0
258 stars 61 forks source link

Cargo use installed container (Local "C:\tomcat) instead of AppData/Local/Temp #124

Closed ravikancherla closed 9 years ago

ravikancherla commented 9 years ago

Hi Ben,

I want to use local tomcat container which is already installed in c:\tomcat instead of cargo downloading container automatically in temp folder. Please help me here. What am i doing wrong?

Here is my build.gradle so far

group = "com.biw.hc" version = "0.1.0_SNAPSHOT"

buildscript { ext { springBootVersion = "1.2.3.RELEASE" tomcatVersion = "8.0.20" logbackJaninoVersion = "2.7.8" } repositories { jcenter() maven { url "http://repo.spring.io/snapshot" } maven { url "http://repo.spring.io/milestone" } maven { url "https://plugins.gradle.org/m2/" } } dependencies { classpath "org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}" classpath "net.saliman:gradle-cobertura-plugin:2.2.7" classpath "com.bmuschko:gradle-cargo-plugin:2.1" } }

apply plugin: "spring-boot" apply plugin: "java" apply plugin: "groovy" apply plugin: 'war' apply plugin: "eclipse" apply plugin: "idea" apply plugin: 'com.bmuschko.cargo'

apply plugin: "net.saliman.cobertura"

bootRepackage { mainClass = 'com.biw.hc.admin.Application' }

war { archiveName 'hcadmin.war' }

repositories { mavenLocal() jcenter() maven { url "http://repo.spring.io/snapshot" } maven { url "http://repo.spring.io/milestone" } }

dependencies { providedRuntime "org.apache.tomcat.embed:tomcat-embed-core" providedRuntime "org.apache.tomcat.embed:tomcat-embed-el" providedRuntime "org.apache.tomcat.embed:tomcat-embed-logging-juli" providedRuntime "org.apache.tomcat.embed:tomcat-embed-websocket" providedRuntime "org.apache.tomcat:tomcat-jdbc:${tomcatVersion}" providedRuntime "org.apache.tomcat:tomcat-juli:${tomcatVersion}" providedRuntime "org.apache.tomcat:tomcat-dbcp:${tomcatVersion}"

compile ("org.springframework.boot:spring-boot-starter-web:${springBootVersion}") {
    exclude module: "spring-boot-starter-tomcat:${springBootVersion}"
}
compile "org.springframework.boot:spring-boot-starter-actuator:${springBootVersion}"
compile "org.springframework.boot:spring-boot-starter-thymeleaf:${springBootVersion}"
compile "org.springframework.boot:spring-boot-starter-data-jpa:${springBootVersion}"
compile("org.codehaus.janino:janino:${logbackJaninoVersion}")

// BIW dependencies...
compile "com.biw.hc:hc-core:0.1.0-SNAPSHOT"

// security dependencies...
compile "org.springframework.boot:spring-boot-starter-security:${springBootVersion}"

// testing dependencies...
testCompile "org.codehaus.groovy:groovy-all:2.2.0"
testCompile "org.spockframework:spock-core:0.7-groovy-2.0"
testCompile "org.spockframework:spock-spring:0.7-groovy-2.0"
testCompile "org.springframework:spring-test:2.5"
testCompile "org.springframework.boot:spring-boot-starter-test:${springBootVersion}"
compile('org.codehaus.groovy.modules.http-builder:http-builder:0.5.1')

def cargoVersion = '1.4.5'
cargo "org.codehaus.cargo:cargo-core-uberjar:$cargoVersion",
      "org.codehaus.cargo:cargo-ant:$cargoVersion"

}

cargo { containerId = 'tomcat8x' port = 8080

deployable {
    file = file('build/libs/hcadmin.war')
    context = 'hcadmin'
}

local {
    homeDir = file('C:\\apache-tomcat-8.0.21')
    outputFile = file('build/output.log')
    containerProperties {
        property 'cargo.tomcat.webappsDirectory', 'build/libs'
    }
}

}

bmuschko commented 9 years ago

Cargo does not automatically download Tomcat. I only does that if you configure it to do so. Otherwise, it uses the Tomcat installation you point to with cargo.local.homeDir. Cargo by default creates a temp directory for deployment purposes and does not drop the deployable archives into the webapps directory. In practice it doesn't really matter where Cargo puts things.

If you really want to deploy to webapps though you can. Instead you'd need to configure Tomcat as a remote container and use the hostname localhost:8080. Keep in mind that you will need to configure the manager application to allow authentication which will also require you to provide username/password through the plugin DSL.

bmuschko commented 9 years ago

Closing this issue as I haven't heard back from you.