javaProject.gradle

来源:互联网 发布:mac 把自己改为管理员 编辑:程序博客网 时间:2024/06/08 13:21
dependencies {    compile fileTree(dir: rootProject.projectDir.absolutePath + '/lib', include: '**/*.jar')}jar {    manifest {        attributes("Implementation-Title": "Gradle",                   "Implementation-Version": rootProject.novatarTargetVersion,                   "Company" : "SF Express",                   "JarVersion" : "v" + rootProject.novatarTargetVersionWithDt)    }    destinationDir = rootProject.destinationDir}task sourcesJar(type: Jar, dependsOn: classes) {    classifier = 'sources'    from sourceSets.main.allSource    destinationDir = rootProject.destinationDir}jar.dependsOn sourcesJarjavadoc.options.memberLevel = JavadocMemberLevel.PRIVATEjavadoc.onlyIf { project.hasProperty('generateJavadoc') && project.property('generateJavadoc') == 'true'}task javadocZip(type: Jar, dependsOn: javadoc) {    classifier = "javadoc"    from tasks["javadoc"]    destinationDir = rootProject.destinationDir}javadocZip.onlyIf { project.hasProperty('generateJavadoc') && project.property('generateJavadoc') == 'true'}eclipse {   project {       linkedResource name : 'pc-rs', type: '2', location : (project(resourceOutputWebProject).projectDir.absolutePath + "/src/main/webapp/pc-rs")       linkedResource name : 'mobile-rs', type: '2', location : (project(resourceOutputWebProject).projectDir.absolutePath + "/src/main/webapp/mobile-rs")   }           classpath {       defaultOutputDir = file(buildDir.name + "/classes/main")       file {          withXml {            def node = it.asNode()            def entryTmp = node.classpathentry.find{it.@kind =="src" && it.@path == "src/main/java"}            if (null != entryTmp){                entryTmp.attributes()['output'] = buildDir.name + '/classes/main';            }            entryTmp = node.classpathentry.find{it.@kind =="src" && it.@path == "src/test/java"}            if (null != entryTmp){                entryTmp.attributes()['output'] = buildDir.name + '/classes/test';            }            entryTmp = node.classpathentry.find{it.@kind =="src" && it.@path == "src/main/resources"}            if (null != entryTmp){                entryTmp.attributes()['output'] = buildDir.name + '/resources/main';            }            entryTmp = node.classpathentry.find{it.@kind =="src" && it.@path == "src/test/resources"}            if (null != entryTmp){                entryTmp.attributes()['output'] = buildDir.name + '/resources/test';            }            def tree = files {file(projectDir.absolutePath + '/src/main/resources/META-INF/resources/pc-rs').listFiles()}            def exclude = ""            def idx = 2            tree.each {File file ->                node.children().add(idx++, new Node(null, "classpathentry", [kind:'src', path:'src/main/resources/META-INF/resources/pc-rs/' + file.name, output : 'pc-rs/' + file.name]))                if (exclude != '') {                    exclude += "|"                }                exclude += ("META-INF/resources/pc-rs/" + file.name + "/").replaceAll('\\.', '/') + "|META-INF/resources/pc-rs/" + file.name + "/"            }            tree = files {file(projectDir.absolutePath + '/src/main/resources/META-INF/resources/mobile-rs').listFiles()}            tree.each {File file ->                node.children().add(idx++, new Node(null, "classpathentry", [kind:'src', path:'src/main/resources/META-INF/resources/mobile-rs/' + file.name, output : 'mobile-rs/' + file.name]))                if (exclude != '') {                    exclude += "|"                }                exclude += ("META-INF/resources/mobile-rs/" + file.name + "/").replaceAll('\\.', '/') + "|META-INF/resources/mobile-rs/" + file.name + "/"            }            if (exclude != ''){                node.classpathentry.find{it.@kind =="src" && it.@path == "src/main/resources"}.attributes()['excluding'] = exclude            }          }       }   }}

0 0
原创粉丝点击