赞
踩
加密:library.gradle
libuild.gradle
中文编码---utf-8
- apply plugin: 'maven'
- apply plugin: 'java'
- apply plugin: 'war'
- apply plugin: 'eclipse-wtp'
- buildDir = "target"
- version = '1.0'
-
- sourceCompatibility = 1.8
- targetCompatibility = 1.8
- //设置文件编码
- [compileJava, javadoc, compileTestJava]*.options*.encoding = 'UTF-8'
-
- //执行task时的JVM args上增加参数-Dfile.encoding=UTF-8,否则中文命名的资源打包后,无法解压。
-
- // 设置 WebApp 根目录
- webAppDirName = 'WebContent'
- //sourceSets.main.java.srcDir 'src' // 设置 Java 源码所在目录
-
- sourceSets {
- client{
- output.classesDir 'bin/client'
- }
- common{
- output.classesDir 'bin/common'
- }
- core{
- output.classesDir 'bin/core'
- }
- dev{
- output.classesDir 'bin/dev'
- }
- main{
- output.classesDir 'bin/server'
- }
- modeling{
- output.classesDir 'bin/modeling'
- }
- test{
- output.classesDir 'bin/test'
- }
- }
-
-
- // 设置 maven 库地址
- repositories {
- mavenCentral() // 中央库
- }
- dependencies {
- // compile files('lib/common/android/apk/AXMLPrinter2.jar')
- // compile files('lib/common/datetime/joda-time-2.3.jar')
- // compile files('lib/common/sql/gsp.jar')
- // compile files('lib/common/weixin/commons-codec-1.9.jar')
- //某个文件夹下面全部依赖
- compile fileTree(dir: 'lib/common/', include: '**/*.jar')
- }
-
-
- dependencies {
- //providedCompile (在war插件中定义)可以确保 servlet-api 能够在编译时被引用,却不随 web 工程发布(运行时由 Web 容器提供)
- providedCompile 'javax.servlet:servlet-api:2.5' // 编译期
- providedRuntime 'javax.servlet:jstl:1.2' // 运行时
- //testCompile group: 'junit', name: 'junit', version: '4.+'
- testCompile (
- 'junit:junit:4.11'
- )
- //compile 中的依赖必然也会被包括在 testCompile 和 runtime
- compile (
- 'io.netty:netty-all:5.0.0.Alpha1',
- 'com.caucho:hessian:4.0.38',
- 'redis.clients:jedis:2.4.1',
- 'cglib:cglib-nodep:3.1',
- 'org.springframework:spring-core:4.1.5.RELEASE',
- 'org.springframework:spring-beans:4.1.5.RELEASE',
- 'org.springframework:spring-context:4.1.5.RELEASE',
- 'com.eaio.uuid:uuid:3.2',
- 'org.apache.poi:poi:3.7',
- 'org.controlsfx:controlsfx:8.20.8',
- 'org.apache.camel:camel-core:2.13.2',
- 'com.google.guava:guava:17.0',
- 'com.google.code.gson:gson:2.3.1',
- 'com.thoughtworks.xstream:xstream:1.4.8',
- 'org.codehaus.woodstox:woodstox-core-asl:4.4.1',
- 'org.apache.httpcomponents:httpclient:4.3.6',
- 'org.apache.httpcomponents:httpcore:4.3.3',
- 'commons-fileupload:commons-fileupload:1.3.1',
- 'com.alibaba:fastjson:1.2.4',
- 'de.jensd:fontawesomefx:8.2' ,
- 'com.fasterxml.jackson.core:jackson-databind:2.5.1',
- 'com.fasterxml.jackson.core:jackson-core:2.5.1',
- 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.5.1',
- 'org.codehaus.woodstox:woodstox-core-asl:4.4.1'
- )
- }
-
- // 设置 Project Facets
- import org.gradle.plugins.ide.eclipse.model.Facet
- eclipse {
- wtp {
- facet {
- facet name: 'jst.web', type: Facet.FacetType.fixed
- facet name: 'wst.jsdt.web', type: Facet.FacetType.fixed
- facet name: 'jst.java', type: Facet.FacetType.fixed
- facet name: 'jst.web', version: '2.5'
- facet name: 'jst.java', version: '1.8'
- facet name: 'wst.jsdt.web', version: '1.0'
- }
- }
- }
-
-
- // 显示当前项目下所有用于 compile 的 jar.
- task listJars(description: 'Display all compile jars.') << {
- configurations.compile.each { File file -> println file.name }
- }
-
- task sourcesJar(type: Jar, dependsOn: classes) {
- classifier = 'sources'
- baseName = 'miboom'
- from sourceSets.main.allSource
- //from fileTree('src/main/aidl').include('**/I*.aidl')
- }
-
- artifacts {
- archives sourcesJar
- }
-
-
- /*****************************************
- * 打包
- *****************************************/
- //jar {
- // manifest {
- // //attributes 'Main-Class': 'com.javachen.gradle.HelloWorld'
- // attributes 'Author': 'zzf'
- // }
- //}
- task jar_dev(type: Jar){
- baseName 'miboom_dev'
- from("bin/dev")
- }
- //不dependsOn: classes,gradle编译出错,直接使用eclipse工程的编译输出bin
- task jar_mc_client(type: Jar) {
- baseName 'mc_client'
- from("bin/client")
- from("bin/server"){
- //除去服务端app、mobile的terminal包及server,模块监听器。
- exclude '**/app/**','**/server/**','**/*ModuleListener*','com/miboom/core/framework/terminal/**'
- exclude "config/**"
- exclude '*.list'
- }
- }
- task jar_mc_common(type: Jar) {
- baseName 'mc_common'
- from("bin/common"){
- exclude '**/*.jj','**/*.jar','**/*.bat','**/*.tpl'
- }
- }
- task jar_ms_common(type: Jar) {
- baseName 'ms_common'
- from("bin/common"){
- exclude '**/*.jj','**/*.jar','**/*.bat','**/*.tpl'
- }
- }
- task jar_mc_core(type: Jar) {
- baseName 'mc_core'
- from("bin/core"){
- exclude '**/readme.txt'
- exclude '**/*.javajet'
- }
- }
- task jar_ms_core(type: Jar) {
- baseName 'ms_core'
- from("bin/core"){
- exclude '**/readme.txt'
- exclude '**/*.javajet'
- }
- }
- task jar_server(type: Jar) {
- baseName 'ms_server'
- from("bin/server")
- }
- task jar_mc_modeling(type: Jar) {
- baseName 'mc_modeling'
- from("bin/modeling")
- }
- task jar_ms_modeling(type: Jar) {
- baseName 'ms_modeling'
- from("bin/modeling")
- }
- task jar_all(dependsOn: ['jar_mc_client','jar_mc_common','jar_ms_common','jar_mc_core','jar_ms_core','jar_server','jar_mc_modeling','jar_ms_modeling']) {
- print "jar all..."
- }
-
-
- war{
- dependsOn jar_all
- from("$projectDir/src/main/resources") {
- include "*.properties"
- into("WEB-INF/classes")
- }
- classpath=classpath - sourceSets.main.output
- classpath fileTree(dir:libsDir, include:"${project.name}-${version}.jar")
- }
- task('jarPath')<<{
- configurations.runtime.resolve().each {
- print it.toString()+";"
- }
- println();
- }
-
- apply from: 'library.gradle'
library.gradle
+jfxrt.jar包
keywords.txt参考proguard
- //
- // This Gradle build file illustrates how to process a program
- // library, such that it remains usable as a library.
- // Usage:
- // gradle -b library.gradle proguard
- //
-
- // Tell Gradle where to find the ProGuard task.
-
- buildscript {
- repositories {
- //flatDir dirs: '../../lib'
- flatDir dirs: './release/proguard5.2/lib'
- // fileTree(dir: './target/libs', include: '**/*.jar')
- }
- dependencies {
- classpath ':proguard'
- }
- }
-
- // Define a ProGuard task.
-
- task proguard(type: proguard.gradle.ProGuardTask) {
-
- // You should probably import a more compact ProGuard-style configuration
- // file for all static settings, but we're specifying them all here, for
- // the sake of the example.
- //configuration 'configuration.pro'
-
- // Specify the input jars, output jars, and library jars.
- // In this case, the input jar is the program library that we want to process.
- injars 'target/libs/ms_server-1.0.jar'
- injars 'target/libs/ms_modeling-1.0.jar'
- injars 'target/libs/ms_core-1.0.jar'
- injars 'target/libs/ms_common-1.0.jar'
- injars 'target/libs/mc_modeling-1.0.jar'
- injars 'target/libs/mc_core-1.0.jar'
- injars 'target/libs/mc_common-1.0.jar'
- injars 'target/libs/mc_client-1.0.jar'
-
- outjars 'target/libs/obfuscate/'
- libraryjars "${System.getProperty('java.home')}/lib/rt.jar"
- libraryjars "${System.getProperty('java.home')}/lib/ext/jfxrt.jar"
- dontwarn
- // Save the obfuscation mapping to a file, so we can de-obfuscate any stack
- // traces later on. Keep a fixed source file attribute and all line number
- // tables to get line numbers in the stack traces.
- // You can comment this out if you're not interested in stack traces.
- obfuscationdictionary 'keywords.txt'
- classobfuscationdictionary 'keywords.txt'
- packageobfuscationdictionary 'keywords.txt'
-
- printmapping 'out.map'
- // keepparameternames
- renamesourcefileattribute 'SourceFile'
- keepattributes 'Exceptions,InnerClasses,Signature,Deprecated,SourceFile,LineNumberTable,EnclosingMethod'
-
- // Preserve all annotations.
-
- keepattributes '*Annotation*'
-
- // Preserve all public classes, and their public and protected fields and
- // methods.
-
- keep 'public class * { \
- public protected *; \
- }'
-
- // Preserve all .class method names.
-
- keepclassmembernames 'class * { \
- java.lang.Class class$(java.lang.String); \
- java.lang.Class class$(java.lang.String, boolean); \
- }'
-
- // Preserve all native method names and the names of their classes.
-
- keepclasseswithmembernames includedescriptorclasses:true, 'class * { \
- native <methods>; \
- }'
-
- // Preserve the special static methods that are required in all enumeration
- // classes.
-
- keepclassmembers allowshrinking:true, 'enum * { \
- public static **[] values(); \
- public static ** valueOf(java.lang.String); \
- }'
-
- // Explicitly preserve all serialization members. The Serializable interface
- // is only a marker interface, so it wouldn't save them.
- // You can comment this out if your library doesn't use serialization.
- // If your code contains serializable classes that have to be backward
- // compatible, please refer to the manual.
-
- keepclassmembers 'class * implements java.io.Serializable { \
- static final long serialVersionUID; \
- static final java.io.ObjectStreamField[] serialPersistentFields; \
- private void writeObject(java.io.ObjectOutputStream); \
- private void readObject(java.io.ObjectInputStream); \
- java.lang.Object writeReplace(); \
- java.lang.Object readResolve(); \
- }'
-
- // Your library may contain more items that need to be preserved;
- // typically classes that are dynamically created using Class.forName:
-
- // keep 'public class mypackage.MyClass'
- // keep 'public interface mypackage.MyInterface'
- // keep 'public class * implements mypackage.MyInterface'
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。