0

I have imported a gradle project in IntelliJ Idea IDE. In my personal WiFi n/w all jars which are specified in build.gradle got downloaded and I can see them in external libs folder but when I try to import the project under company n/w those jars don't get downloaded. I guess its bcoz Company has blocked the sites to download.I have all those bunch of jar files and now I want it to add it manually. I have tried

File ->Project structure->Modules ->dependencies 

here I added library of jars. But still I am getting 100s of compile time errors. I added the jars in library too. Note- the bunch of jars which I have are having specific folder structure.I mean each jar is under folder inside folder n I have added directly the folders as it's difficult to add only jar as there as so so many jar files which need to add. My Build.Gradle file-

apply plugin: 'java'

sourceCompatibility = 1.7

def axis2Dir = '../apache-tomcat/webapps/axis2/'
def releaseDir = "R:/PepsiCo/release/"

repositories {
    mavenCentral()
}

dependencies {
    compile 'log4j:log4j:1.2.17',
            'commons-lang:commons-lang:2.6',
            'commons-httpclient:commons-httpclient:3.1',
            'commons-io:commons-io:1.4',
            'org.apache.commons:commons-email:1.3.3',
            'org.springframework:spring-jdbc:3.0.7.RELEASE',
            'org.springframework:spring-test:3.0.7.RELEASE',
            'org.apache.axis2:axis2:1.6.1',
            'org.flywaydb:flyway-core:3.0',
            'com.h2database:h2:1.3.176',
            'org.apache.ws.commons.axiom:axiom-api:1.2.12',
            'wsdl4j:wsdl4j:1.6.2',
            'org.apache.ws.commons.schema:XmlSchema:1.4.7',
            'org.apache.ws.commons.axiom:axiom-impl:1.2.12',
            'org.apache.neethi:neethi:3.0.1',
            'org.apache.axis2:axis2-transport-local:1.6.1',
            'org.apache.axis2:axis2-transport-http:1.6.1',
            'net.sf.ehcache:ehcache:2.9.0',
            'org.apache.chemistry.opencmis:chemistry-opencmis-client-impl:0.12.0',
    fileTree(dir: 'lib', include: '*.jar')
    testCompile 'junit:junit:4.11',
                'org.assertj:assertj-core:2.1.0'
}

task deployTws(type: Copy) {
    from libsDir
    into "$axis2Dir/WEB-INF/services/${project.name}/lib/"
    include '*.jar'
}

task undeployTws(type: Delete) {
    delete "$axis2Dir/WEB-INF/services/${project.name}"
}

task deployJar(type: Copy) {
    from libsDir
    into "$axis2Dir/WEB-INF/services/"
    include '*.jar'
}

// Remove hardcoding. See http://stackoverflow.com/questions/11428954/gradle-zip-packaging-copy-jar-file-from-repository.
task deployLib(type: Copy) {
    from "$buildDir/lib/"
    into "$axis2Dir/WEB-INF/lib/"
    include 'flyway-core-3.0.jar', 'h2-1.3.176.jar', 'commons-email-1.3.3.jar', 'ehcache-2.9.0.jar', 'pqppv-client.jar', 'pqpvcs-client.jar', 'pqpfds-client.jar', "chemistry-opencmis-commons-impl-0.12.0.jar", "chemistry-opencmis-client-api-0.12.0.jar", "chemistry-opencmis-client-bindings-0.12.0.jar", "chemistry-opencmis-client-impl-0.12.0.jar", "chemistry-opencmis-commons-api-0.12.0.jar"
    // 'rasapp.jar', 'rascore.jar', 'serialization.jar', 'logging.jar'
}

task deployFlyway(type: Copy) {
    from 'src/main/resources/db/migration/'
    into "$axis2Dir/WEB-INF/classes/db/migration/"
    include 'V*.sql'
    // include '**/*'
}

task deployResources(type: Copy) {
    from 'src/main/resources/'
    into "$axis2Dir/WEB-INF/classes/"
    include '*.conf', '*.properties', 'ehcache.xml'
}

task undeployJar(type: Delete) {
    delete "$axis2Dir/WEB-INF/services/$archivesBaseName-${version}.jar"
}

task deployTwsXml(type: Copy) {
    from 'src/main/resources/META-INF/'
    into "$axis2Dir/WEB-INF/services/${project.name}/META-INF/"
}

task copyLibs(type: Copy) {
    from configurations.runtime
    into "$buildDir/lib"
}

// Creates pqp-tws/build/distributions/pqp-tws.zip
task zipPackage(type: Zip) {
    from axis2Dir
    include 'WEB-INF/lib/flyway-core-3.0.jar',
            'WEB-INF/lib/h2-1.3.176.jar',
            'WEB-INF/lib/pqppv-client.jar',
            'WEB-INF/lib/pqpvcs-client.jar',
            'WEB-INF/lib/pqpfds-client.jar',
            'WEB-INF/lib/commons-email-1.3.3.jar',
            'WEB-INF/lib/ehcache-2.9.0.jar',
            'WEB-INF/lib/chemistry-opencmis-commons-impl-0.12.0.jar',
            'WEB-INF/lib/chemistry-opencmis-client-api-0.12.0.jar',
            'WEB-INF/lib/chemistry-opencmis-client-bindings-0.12.0.jar',
            'WEB-INF/lib/chemistry-opencmis-client-impl-0.12.0.jar',
            'WEB-INF/lib/chemistry-opencmis-commons-api-0.12.0.jar',
            'WEB-INF/services/pqp-tws.jar',
            'WEB-INF/classes/pqp-field.properties',
            'WEB-INF/classes/pqp-foundational.conf',
            'WEB-INF/classes/pqp-prescreen.conf',
            'WEB-INF/classes/ehcache.xml',
            'WEB-INF/classes/db/migration/*.sql'
             // 'WEB-INF/lib/rasapp.jar', 'WEB-INF/lib/rascore.jar', 'WEB-INF/lib/serialization.jar', 'WEB-INF/lib/logging.jar'
}

task releaseZip(type: Copy) {
    from "$buildDir/distributions/${project.name}.zip"
    into "$releaseDir"
}

task configlessJar(type: Jar) {
    from sourceSets.main.output
    exclude 'pqp.properties', 'pqp-field.properties', 'pqp-foundational.conf', 'pqp-prescreen.conf', 'ehcache.xml'
}

deployTws.dependsOn configlessJar, deployTwsXml

deployJar.dependsOn undeployJar, clean, configlessJar, copyLibs, deployLib, deployFlyway, deployResources

releaseZip {}.dependsOn deployJar, zipPackage
Sarika
  • 11
  • 4
  • does [this](http://stackoverflow.com/a/1051705/4290096) help ? – Arun Xavier Feb 22 '16 at 04:46
  • can you post your build.gradle? Even when you manually add jars you should still have the compile 'jarname' under dependencies. – ChonBonStudios Feb 22 '16 at 04:46
  • Hi JAVY i try that but it didn't helped. – Sarika Feb 22 '16 at 04:54
  • @ChonBonStudios apply plugin: 'java' sourceCompatibility = 1.7 def axis2Dir = '../apache-tomcat/webapps/axis2/' def releaseDir = "R:/PepsiCo/release/" repositories { mavenCentral() } dependencies { compile 'log4j:log4j:1.2.17', 'commons-lang:commons-lang:2.6', 'commons-httpclient:commons-httpclient:3.1', 'commons-io:commons-io:1.4', 'org.apache.commons:commons-email:1.3.3', 'org.springframework:spring-jdbc:3.0.7.RELEASE', – Sarika Feb 22 '16 at 05:10
  • Yes under dependencies Compile jar names are there. As the file size is big i am not able to add whole file. – Sarika Feb 22 '16 at 05:11
  • 1
    Don't add additional information in comments, edit your question to append the information to it. – RaGe Feb 22 '16 at 05:28
  • I got the solution. I was adding jar files inside a folder structure.This was my mistake. I added only jar files in File->Project Structure->libraries->add – Sarika Feb 23 '16 at 06:12

0 Answers0