Browse Source

git-svn-id: svn+ssh://10.10.101.21/source/platform/platform-b2b@1099 f3bf4e98-0cf0-11e4-a00c-a99a8b9d557d

administrator 10 years ago
parent
commit
046c01f38b
2 changed files with 53 additions and 166 deletions
  1. 0 57
      build.xml
  2. 53 109
      pom.xml

+ 0 - 57
build.xml

@@ -1,57 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project name="platform-b2b" default="compress">
-	<property name="yuicompressor"
-		value="${project.build.directory}/compressor/yuicompressor.jar" />
-	<property name="closure-compiler"
-		value="${project.build.directory}/compressor/closure-compiler.jar" />
-	<property name="compress.directory"
-		value="${project.build.directory}/${project.build.finalName}/resources" />
-	<property name="js.compress.directory" value="${compress.directory}/js" />
-	<property name="css.compress.directory" value="${compress.directory}/css" />
-
-	<target name="compressJs" description="压缩 JS 文件">
-		<echo message="开始压缩,请耐心等待!" />
-		<apply executable="java" verbose="true" parallel="false"
-			failonerror="true" dest="${js.compress.directory}">
-			<fileset dir="${js.compress.directory}" includes="**/*.js" />
-			<arg line="-jar" />
-			<arg path="${closure-compiler}" />
-			<arg line="--warning_level QUIET" />
-			<arg line="--compilation_level SIMPLE_OPTIMIZATIONS" />
-			<arg line="--js" />
-			<srcfile />
-			<arg line="--js_output_file" />
-			<targetfile />
-			<mapper type="regexp" from="^(.*)\.(js)$" to="\1-min.\2" />
-		</apply>
-		<move todir="${js.compress.directory}">
-			<fileset dir="${js.compress.directory}" includes="**/*.js" />
-			<mapper type="regexp" from="^(.*)-min\.(js)$" to="\1.\2" />
-		</move>
-		<echo message="压缩成功!" />
-	</target>
-	<target name="compressCss" description="压缩 CSS 文件">
-		<echo message="开始压缩,请耐心等待!" />
-		<apply executable="java" verbose="true" parallel="false"
-			failonerror="true" dest="${css.compress.directory}">
-			<fileset dir="${css.compress.directory}" includes="**/*.css" />
-			<arg line="-jar" />
-			<arg path="${yuicompressor}" />
-			<arg line="--charset UTF-8" />
-			<arg value="--type" />
-			<arg value="css" />
-			<srcfile />
-			<arg line="-o" />
-			<targetfile />
-			<mapper type="regexp" from="^(.*)\.(css)$" to="\1-min.\2" />
-		</apply>
-		<move todir="${css.compress.directory}">
-			<fileset dir="${css.compress.directory}" includes="**/*.css" />
-			<mapper type="regexp" from="^(.*)-min\.(css)$" to="\1.\2" />
-		</move>
-		<echo message="压缩成功!" />
-	</target>
-	<target name="compress" depends="compressJs,compressCss">
-
-	</target>
-</project>

+ 53 - 109
pom.xml

@@ -198,135 +198,79 @@
 	</dependencies>
 	<build>
 		<finalName>platform-b2b</finalName>
-		<pluginManagement>
-			<plugins>
-				<plugin>
-					<groupId>org.eclipse.m2e</groupId>
-					<artifactId>lifecycle-mapping</artifactId>
-					<version>1.0.0</version>
-					<configuration>
-						<lifecycleMappingMetadata>
-							<pluginExecutions>
-								<pluginExecution>
-									<pluginExecutionFilter>
-										<groupId>org.apache.maven.plugins</groupId>
-										<artifactId>maven-antrun-plugin</artifactId>
-										<versionRange>[1.0,)</versionRange>
-										<goals>
-											<goal>run</goal>
-										</goals>
-									</pluginExecutionFilter>
-									<action>
-										<ignore />
-									</action>
-								</pluginExecution>
-								<pluginExecution>
-									<pluginExecutionFilter>
-										<groupId>org.apache.maven.plugins</groupId>
-										<artifactId>maven-dependency-plugin</artifactId>
-										<versionRange>[1.0,)</versionRange>
-										<goals>
-											<goal>copy</goal>
-										</goals>
-									</pluginExecutionFilter>
-									<action>
-										<ignore />
-									</action>
-								</pluginExecution>
-							</pluginExecutions>
-						</lifecycleMappingMetadata>
-					</configuration>
-				</plugin>
-			</plugins>
-		</pluginManagement>
 		<plugins>
-			<plugin>
-				<groupId>org.apache.maven.plugins</groupId>
-				<artifactId>maven-compiler-plugin</artifactId>
-				<configuration>
-					<source>1.7</source>
-					<target>1.7</target>
-				</configuration>
-			</plugin>
+			<!-- <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> 
+				<configuration> <source>1.7</source> <target>1.7</target> </configuration> 
+				</plugin> -->
 			<!-- <plugin> <groupId>org.jboss.as.plugins</groupId> <artifactId>jboss-as-maven-plugin</artifactId> 
 				<version>7.6.Final</version> <executions> <execution> 下面部分是让执行 mvn install 
 				时 自动执行jboss-as:deploy <phase>install</phase> <goals> <goal>deploy</goal> 
 				</goals> 远程服务器的相关配置 <configuration> <hostname>60.host</hostname> <port>9999</port> 
 				用户名和密码为jboss as 中添加的用户名和密码 <username>administrator</username> <password>select111***</password> 
 				</configuration> </execution> </executions> </plugin> -->
-			<!-- <plugin>
-				<groupId>org.apache.tomcat.maven</groupId>
-				<artifactId>tomcat7-maven-plugin</artifactId>
-				<version>2.2</version>
-				<executions> <execution> <phase>install</phase> <goals> <goal>deploy</goal> 
-					</goals> <configuration> <url>http://60.host:9090/manager/text</url> <username>administrator</username> 
-					<password>select111***</password> <path>/platform-b2b</path> <update>true</update> 
-					</configuration> </execution> </executions>
-			</plugin> -->
+			<!-- <plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> 
+				<version>2.2</version> <executions> <execution> <phase>install</phase> <goals> 
+				<goal>deploy</goal> </goals> <configuration> <url>http://60.host:9090/manager/text</url> 
+				<username>administrator</username> <password>select111***</password> <path>/platform-b2b</path> 
+				<update>true</update> </configuration> </execution> </executions> </plugin> -->
 			<plugin>
-				<groupId>org.apache.maven.plugins</groupId>
-				<artifactId>maven-dependency-plugin</artifactId>
-				<version>2.4</version>
+				<groupId>com.samaxes.maven</groupId>
+				<artifactId>minify-maven-plugin</artifactId>
+				<version>1.7.4</version>
 				<executions>
 					<execution>
-						<phase>validate</phase>
-						<goals>
-							<goal>copy</goal>
-						</goals>
+						<id>default-minify</id>
+						<phase>prepare-package</phase>
 						<configuration>
-							<artifactItems>
-								<artifactItem>
-									<groupId>com.google.javascript</groupId>
-									<artifactId>closure-compiler</artifactId>
-									<version>v20150505</version>
-									<type>jar</type>
-									<overWrite>true</overWrite>
-									<outputDirectory>${project.build.directory}/compressor</outputDirectory>
-									<destFileName>closure-compiler.jar</destFileName>
-								</artifactItem>
-								<artifactItem>
-									<groupId>com.yahoo.platform.yui</groupId>
-									<artifactId>yuicompressor</artifactId>
-									<version>2.4.8</version>
-									<type>jar</type>
-									<overWrite>true</overWrite>
-									<outputDirectory>${project.build.directory}/compressor</outputDirectory>
-									<destFileName>yuicompressor.jar</destFileName>
-								</artifactItem>
-							</artifactItems>
+							<charset>UTF-8</charset>
+							<skipMerge>true</skipMerge>
+							<closureLanguage>ECMASCRIPT5</closureLanguage>
+							<closureAngularPass>true</closureAngularPass>
+							<nosuffix>true</nosuffix>
+							<webappTargetDir>${project.build.directory}/minify</webappTargetDir>
+							<cssSourceDir>resources/css</cssSourceDir>
+							<cssEngine>YUI</cssEngine>
+							<jsSourceDir>resources/js</jsSourceDir>
+							<jsEngine>CLOSURE</jsEngine>
+							<cssSourceIncludes>
+								<cssSourceInclude>**/*.css</cssSourceInclude>
+							</cssSourceIncludes>
+							<cssSourceExcludes>
+								<cssSourceExclude>**/*.min.css</cssSourceExclude>
+							</cssSourceExcludes>
+							<jsSourceIncludes>
+								<jsSourceInclude>**/*.js</jsSourceInclude>
+							</jsSourceIncludes>
+							<jsSourceExcludes>
+								<jsSourceExclude>**/*.min.js</jsSourceExclude>
+							</jsSourceExcludes>
 						</configuration>
+						<goals>
+							<goal>minify</goal>
+						</goals>
 					</execution>
 				</executions>
 			</plugin>
 			<plugin>
 				<groupId>org.apache.maven.plugins</groupId>
-				<artifactId>maven-antrun-plugin</artifactId>
-				<version>1.7</version>
-				<executions>
-					<execution>
-						<phase>install</phase>
-						<configuration>
-							<tasks>
-								<property name="project.build.directory" value="${project.build.directory}" />
-								<property name="project.build.finalName" value="${project.build.finalName}" />
-								<ant antfile="build.xml" />
-							</tasks>
-						</configuration>
-						<goals>
-							<goal>run</goal>
-						</goals>
-					</execution>
-				</executions>
-				<dependencies>
-					<dependency>
-						<groupId>org.apache.ant</groupId>
-						<artifactId>ant-launcher</artifactId>
-						<version>1.8.2</version>
-					</dependency>
-				</dependencies>
+				<artifactId>maven-war-plugin</artifactId>
+				<version>2.4</version>
+				<configuration>
+					<webResources>
+						<resource>
+							<directory>${project.build.directory}/minify</directory>
+						</resource>
+					</webResources>
+				</configuration>
 			</plugin>
 		</plugins>
 	</build>
+	<properties>
+		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+		<maven.compiler.source>1.7</maven.compiler.source>
+		<maven.compiler.target>1.7</maven.compiler.target>
+		<skipTests>true</skipTests>
+	</properties>
 	<distributionManagement>
 		<!-- 发布release仓库 -->
 		<repository>