1. 环境设置
1.1. Java环境设置
1)JAVA_HOME
D:\GreenSoftware\Java\Java8X64\jdk1.8.0_91
2)PATH
;%JAVA_HOME%/bin;%JAVA_HOME%/jre/bin
3)CLASSPATH
.;%JAVA_HOME%/lib;%JAVA_HOME%/lib/dt.jar;%JAVA_HOME%/lib/tools.jar
1.2. Mave环境设置
1.2.1. Maven环境变量
4)MAVEN_HOME
D:\GreenSoftware\apache-maven-3.0.5
5)PATH
;%MAVEN_HOME%/bin
1.2.2. Maven参数配置
修改“D:\GreenSoftware\apache-maven-3.0.5\conf\settings.xml”
(1)添加(红色部分)
<localRepository>D:/GreenSoftware/Java/repository</localRepository>
<profiles>
<profile>
<id>compiler</id>
<properties>
<JAVA_HOME>D:\GreenSoftware\Java\Java8X64\jdk1.8.0_91</JAVA_HOME>
</properties>
</profile>
</profiles>
<activeProfiles>
<activeProfile>compiler</activeProfile>
</activeProfiles>
1.3. Eclipse环境设置
(1)
在Eclipse目录下的eclipse.ini文件开头加入如下代码:
-vm
D:/GreenSoftware/Java/Java8X64/jdk1.8.0_91/jre/bin/server/jvm.dll
(2)
(3)
(4)
1.4. Flex环境设置
(1)
将“flashplayer.exe”文件放入”C:\Windows”
(2)加入依赖包
agslib-3.6-2013-12-13.swc
mvn install:install-file -Dfile=agslib-3.6-2013-12-13.swc -DgroupId=com.esri -DartifactId=agslib -Dversion=3.6-2013-12-13 -Dpackaging=swc
agslib-2.5-2011-11-30
mvn install:install-file -Dfile=agslib-2.5-2011-11-30.swc -DgroupId=com.esri -DartifactId=agslib -Dversion=2.5-2011-11-30 -Dpackaging=swc
amCharts-4.0.swc
mvn install:install-file -Dfile=amCharts-4.0.swc -DgroupId=com.amcharts -DartifactId=amCharts -Dversion=4.0 -Dpackaging=swc
GifPlayer-1.0.swc
mvn install:install-file -Dfile=GifPlayer-1.0.swc -DgroupId=org.gif -DartifactId=GifPlayer -Dversion=1.0 -Dpackaging=swc
PlotAPI-4.0.swc
mvn install:install-file -Dfile=PlotAPI-4.0.swc -DgroupId=com.esrichina -DartifactId=PlotAPI -Dversion=4.0 -Dpackaging=swc
as3-signals-0.8.swc
mvn install:install-file -Dfile=as3-signals-0.8.swc -DgroupId=org.osflash -DartifactId=as3-signals -Dversion=0.8 -Dpackaging=swc
2. 工程构建
2.1. 生成工程结构
cd d:/Project/workspace/mete
mvn archetype:generate -DarchetypeRepository=http://repository.sonatype.org/content/groups/flexgroup -DarchetypeGroupId=org.sonatype.flexmojos -DarchetypeArtifactId=flexmojos-archetypes-modular-webapp -DarchetypeVersion=4.0-beta-3
Define value for property 'groupId': : com.summit.mete
Define value for property 'artifactId': : meteapp
Define value for property 'version': 1.0-SNAPSHOT: : 1.0
Define value for property 'package': com.summit.mete: : pom
2.2. 修改目录名
2.3. 修改pom.xml文件
1.4.1. 最外一层pom.xml
<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.summit.mete</groupId>
<artifactId>meteapp</artifactId>
<version>1.0</version>
<packaging>pom</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.encoding>UTF-8</maven.compiler.encoding>
<flex.version>4.5.1.21328</flex.version>
<flex.theme>halo</flex.theme>
<flex.theme.type>swc</flex.theme.type>
<flex.tlf.version>2.0.0.232</flex.tlf.version>
<flex.osmf.version>1.0.0.16316</flex.osmf.version>
<flexmojos.version>4.2-beta</flexmojos.version>
</properties>
<modules>
<module>MapLab</module>
<module>MeteMap</module>
<module>MeteWeb</module>
</modules>
<dependencyManagement>
<!--
<dependencies>
<dependency>
<optional>true</optional>
<groupId>org.apache.flex.framework.themes</groupId>
<artifactId>${flex.theme}</artifactId>
<version>${flex.version}</version>
<type>${flex.theme.type}</type>
<scope>theme</scope>
</dependency>
</dependencies>
-->
</dependencyManagement>
<repositories>
<repository>
<id>flex-mojos-repository</id>
<url>http://repository.sonatype.org/content/groups/flexgroup</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>flex-mojos-plugin-repository</id>
<url>http://repository.sonatype.org/content/groups/flexgroup</url>
</pluginRepository>
</pluginRepositories>
</project>
1.4.2. MapLab/pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>meteapp</artifactId>
<groupId>com.summit.mete</groupId>
<version>1.0</version>
</parent>
<groupId>com.summit.mete</groupId>
<artifactId>MapLab</artifactId>
<version>1.0</version>
<packaging>swc</packaging>
<name>MapLab</name>
<properties>
<flex.linkReportAttach>false</flex.linkReportAttach>
</properties>
<build>
<sourceDirectory>src/main/flex</sourceDirectory>
<testSourceDirectory>src/test/flex</testSourceDirectory>
<plugins>
<plugin>
<groupId>org.sonatype.flexmojos</groupId>
<artifactId>flexmojos-maven-plugin</artifactId>
<version>${flexmojos.version}</version>
<extensions>true</extensions>
<configuration>
<optimize>true</optimize>
<debug>false</debug>
<encoding>UTF-8</encoding>
<coverage>false</coverage>
<configurationReport>false</configurationReport>
<!--
<linkReportAttach>false</linkReportAttach>
<sizeReportAttach>false</sizeReportAttach>
<benchmark>false</benchmark>
-->
<locales>
<locale>zh_CN</locale>
</locales>
<themes>
<theme>${settings.localRepository}/com/adobe/flex/framework/spark/${flex.version}/spark-${flex.version}-theme.css</theme>
<theme>${project.build.sourceDirectory}/defaults.css</theme>
</themes>
</configuration>
<dependencies>
<dependency>
<groupId>com.adobe.flex</groupId>
<artifactId>compiler</artifactId>
<version>${flex.version}</version>
<type>pom</type>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.adobe.flex.framework</groupId>
<artifactId>framework</artifactId>
<version>${flex.version}</version>
<type>swc</type>
<scope>caching</scope>
</dependency>
<dependency>
<groupId>com.adobe.flex.framework</groupId>
<artifactId>textLayout</artifactId>
<version>${flex.version}</version>
<type>swc</type>
<scope>caching</scope>
</dependency>
<dependency>
<groupId>com.adobe.flex.framework</groupId>
<artifactId>spark</artifactId>
<version>${flex.version}</version>
<type>swc</type>
<scope>caching</scope>
</dependency>
<dependency>
<groupId>com.adobe.flex.framework</groupId>
<artifactId>sparkskins</artifactId>
<version>${flex.version}</version>
<type>swc</type>
<scope>caching</scope>
</dependency>
<dependency>
<groupId>com.adobe.flex.framework</groupId>
<artifactId>rpc</artifactId>
<version>${flex.version}</version>
<type>swc</type>
<scope>caching</scope>
</dependency>
<dependency>
<groupId>com.adobe.flex.framework</groupId>
<artifactId>charts</artifactId>
<version>${flex.version}</version>
<type>swc</type>
<scope>caching</scope>
</dependency>
<dependency>
<groupId>com.adobe.flex.framework</groupId>
<artifactId>spark_dmv</artifactId>
<version>${flex.version}</version>
<type>swc</type>
<scope>caching</scope>
</dependency>
<dependency>
<groupId>com.adobe.flex.framework</groupId>
<artifactId>osmf</artifactId>
<version>${flex.version}</version>
<type>swc</type>
<scope>caching</scope>
</dependency>
<dependency>
<groupId>com.adobe.flex.framework</groupId>
<artifactId>mx</artifactId>
<version>${flex.version}</version>
<type>swc</type>
<scope>caching</scope>
</dependency>
<dependency>
<groupId>com.adobe.flex.framework</groupId>
<artifactId>advancedgrids</artifactId>
<version>${flex.version}</version>
<type>swc</type>
<scope>caching</scope>
</dependency>
<dependency>
<groupId>com.adobe.flex.framework</groupId>
<artifactId>flex-framework</artifactId>
<version>${flex.version}</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>com.adobe.flex</groupId>
<artifactId>compiler</artifactId>
<version>${flex.version}</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>com.adobe.flexunit</groupId>
<artifactId>flexunit</artifactId>
<version>0.85</version>
<type>swc</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.adobe.flex.framework</groupId>
<artifactId>spark</artifactId>
<version>${flex.version}</version>
<classifier>theme</classifier>
<type>css</type>
<scope>theme</scope>
</dependency>
<dependency>
<groupId>com.esri</groupId>
<artifactId>agslib</artifactId>
<version>2.5-2011-11-30</version>
<type>swc</type>
</dependency>
<dependency>
<groupId>com.amcharts</groupId>
<artifactId>amCharts</artifactId>
<version>4.0</version>
<type>swc</type>
</dependency>
<dependency>
<groupId>org.gif</groupId>
<artifactId>GifPlayer</artifactId>
<version>1.0</version>
<type>swc</type>
</dependency>
<dependency>
<groupId>com.esrichina</groupId>
<artifactId>PlotAPI</artifactId>
<version>4.0</version>
<type>swc</type>
</dependency>
</dependencies>
</project>
1.4.3. MeteMap/pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.summit.mete</groupId>
<artifactId>meteapp</artifactId>
<version>1.0</version>
</parent>
<groupId>com.summit.mete</groupId>
<artifactId>MeteMap</artifactId>
<version>1.0</version>
<packaging>swf</packaging>
<name>MeteMap</name>
<properties>
</properties>
<build>
<sourceDirectory>src/main/flex</sourceDirectory>
<testSourceDirectory>src/test/flex</testSourceDirectory>
<plugins>
<plugin>
<groupId>org.sonatype.flexmojos</groupId>
<artifactId>flexmojos-maven-plugin</artifactId>
<version>${flexmojos.version}</version>
<extensions>true</extensions>
<!-- -->
<configuration>
<optimize>true</optimize>
<debug>false</debug>
<encoding>UTF-8</encoding>
<coverage>false</coverage>
<configurationReport>false</configurationReport>
<!--
<linkReportAttach>false</linkReportAttach>
<sizeReportAttach>false</sizeReportAttach>
<benchmark>false</benchmark>
-->
<finalName>index</finalName>
<locales>
<locale>zh_CN</locale>
</locales>
<sourceFile>index.mxml</sourceFile>
<themes>
<theme>${settings.localRepository}/com/adobe/flex/framework/spark/${flex.version}/spark-${flex.version}-theme.css</theme>
<theme>${project.build.sourceDirectory}/defaults.css</theme>
</themes>
<!-- modules -->
<modules>
<module>
<sourceFile>widgets/panel/Head/HeadWidget.mxml</sourceFile>
<optimize>true</optimize>
<finalName>widgets/panel/Head/HeadWidget</finalName>
</module>
<module>
<sourceFile>widgets/panel/MainContainer/MainContainerWidget.mxml</sourceFile>
<optimize>true</optimize>
<finalName>widgets/panel/MainContainer/MainContainerWidget</finalName>
</module>
<module>
<sourceFile>widgets/panel/SystemMenu/SystemMenuWidget.mxml</sourceFile>
<optimize>true</optimize>
<finalName>widgets/panel/SystemMenu/SystemMenuWidget</finalName>
</module>
<module>
<sourceFile>widgets/ToolBar/ToolBarWidget.mxml</sourceFile>
<optimize>true</optimize>
<finalName>widgets/ToolBar/ToolBarWidget</finalName>
</module>
<module>
<sourceFile>widgets/LayerList/LayerListWidget.mxml</sourceFile>
<optimize>true</optimize>
<finalName>widgets/LayerList/LayerListWidget</finalName>
</module>
<module>
<sourceFile>widgets/Test/BaseModuleTest/BaseModuleTestWidget.mxml</sourceFile>
<optimize>true</optimize>
<finalName>widgets/Test/BaseModuleTest/BaseModuleTestWidget</finalName>
</module>
<module>
<sourceFile>widgets/Test/BaseWidgetTest/BaseWidgetTestWidget.mxml</sourceFile>
<optimize>true</optimize>
<finalName>widgets/Test/BaseWidgetTest/BaseWidgetTestWidget</finalName>
</module>
</modules>
</configuration>
<dependencies>
<dependency>
<groupId>com.adobe.flex</groupId>
<artifactId>compiler</artifactId>
<version>${flex.version}</version>
<type>pom</type>
</dependency>
</dependencies>
<executions>
<execution>
<goals>
<goal>wrapper</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.sonatype.flexmojos</groupId>
<artifactId>flexmojos-maven-plugin</artifactId>
<versionRange>[3.9,)</versionRange>
<goals>
<goal>test-compile</goal>
<goal>compile-swf</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<dependencies>
<dependency>
<groupId>com.adobe.flex.framework</groupId>
<artifactId>framework</artifactId>
<version>${flex.version}</version>
<type>swc</type>
<scope>caching</scope>
</dependency>
<dependency>
<groupId>com.adobe.flex.framework</groupId>
<artifactId>textLayout</artifactId>
<version>${flex.version}</version>
<type>swc</type>
<scope>caching</scope>
</dependency>
<dependency>
<groupId>com.adobe.flex.framework</groupId>
<artifactId>spark</artifactId>
<version>${flex.version}</version>
<type>swc</type>
<scope>caching</scope>
</dependency>
<dependency>
<groupId>com.adobe.flex.framework</groupId>
<artifactId>sparkskins</artifactId>
<version>${flex.version}</version>
<type>swc</type>
<scope>caching</scope>
</dependency>
<dependency>
<groupId>com.adobe.flex.framework</groupId>
<artifactId>rpc</artifactId>
<version>${flex.version}</version>
<type>swc</type>
<scope>caching</scope>
</dependency>
<dependency>
<groupId>com.adobe.flex.framework</groupId>
<artifactId>charts</artifactId>
<version>${flex.version}</version>
<type>swc</type>
<scope>caching</scope>
</dependency>
<dependency>
<groupId>com.adobe.flex.framework</groupId>
<artifactId>spark_dmv</artifactId>
<version>${flex.version}</version>
<type>swc</type>
<scope>caching</scope>
</dependency>
<dependency>
<groupId>com.adobe.flex.framework</groupId>
<artifactId>osmf</artifactId>
<version>${flex.version}</version>
<type>swc</type>
<scope>caching</scope>
</dependency>
<dependency>
<groupId>com.adobe.flex.framework</groupId>
<artifactId>mx</artifactId>
<version>${flex.version}</version>
<type>swc</type>
<scope>caching</scope>
</dependency>
<dependency>
<groupId>com.adobe.flex.framework</groupId>
<artifactId>advancedgrids</artifactId>
<version>${flex.version}</version>
<type>swc</type>
<scope>caching</scope>
</dependency>
<dependency>
<groupId>com.adobe.flex.framework</groupId>
<artifactId>flex-framework</artifactId>
<version>${flex.version}</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>com.adobe.flex</groupId>
<artifactId>compiler</artifactId>
<version>${flex.version}</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>com.adobe.flexunit</groupId>
<artifactId>flexunit</artifactId>
<version>0.85</version>
<type>swc</type>
<scope>test</scope>
</dependency>
<!-- THEMES -->
<dependency>
<groupId>com.adobe.flex.framework</groupId>
<artifactId>spark</artifactId>
<version>${flex.version}</version>
<classifier>theme</classifier>
<type>css</type>
<scope>theme</scope>
</dependency>
<dependency>
<groupId>com.esri</groupId>
<artifactId>agslib</artifactId>
<version>2.5-2011-11-30</version>
<type>swc</type>
</dependency>
<dependency>
<groupId>com.amcharts</groupId>
<artifactId>amCharts</artifactId>
<version>4.0</version>
<type>swc</type>
</dependency>
<dependency>
<groupId>org.gif</groupId>
<artifactId>GifPlayer</artifactId>
<version>1.0</version>
<type>swc</type>
</dependency>
<dependency>
<groupId>com.esrichina</groupId>
<artifactId>PlotAPI</artifactId>
<version>4.0</version>
<type>swc</type>
</dependency>
<dependency>
<groupId>com.summit.mete</groupId>
<artifactId>MapLab</artifactId>
<version>1.0</version>
<type>swc</type>
</dependency>
</dependencies>
</project>
1.4.4. MeteWeb/pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>meteapp</artifactId>
<groupId>com.summit.mete</groupId>
<version>1.0</version>
</parent>
<groupId>com.summit.mete</groupId>
<artifactId>MeteWeb</artifactId>
<version>1.0</version>
<packaging>war</packaging>
<properties>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.sonatype.flexmojos</groupId>
<artifactId>flexmojos-maven-plugin</artifactId>
<version>${flexmojos.version}</version>
<extensions>true</extensions>
<configuration>
<policyFileUrls>
<url>http://fpdownload.adobe.com/pub/swz/crossdomain.xml</url>
<url>http://fpdownload.adobe.com/pub/swz/crossdomain.xml</url>
<url>http://fpdownload.adobe.com/pub/swz/crossdomain.xml</url>
</policyFileUrls>
<rslUrls>
<url>http://fpdownload.adobe.com/pub/{extension}/flex/${flex.version}/{artifactId}_{version}.{extension}</url>
<url>http://fpdownload.adobe.com/pub/{extension}/tlf/${flex.tlf.version}/{artifactId}_${flex.tlf.version}.{extension}</url>
<url>http://fpdownload.adobe.com/pub/{extension}/flex/${flex.version}/{artifactId}_${flex.osmf.version}.{extension}</url>
</rslUrls>
</configuration>
<executions>
<execution>
<goals>
<goal>copy-flex-resources</goal>
</goals>
<configuration>
<encoding>UTF-8</encoding>
<configurationReport>false</configurationReport>
<webappDirectory>${basedir}/src/main/webapp/gis</webappDirectory>
<storepass/>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<encoding>UTF-8</encoding>
<outputDirectory>${basedir}/src/main/webapp/gis</outputDirectory>
<resources>
<resource>
<directory>${basedir}/../MeteMap/src/main/flex</directory>
<excludes>
<exclude>**/*.mxml</exclude>
<exclude>**/*.as</exclude>
<exclude>**/*.css</exclude>
</excludes>
<filtering>false</filtering>
</resource>
<resource>
<directory>${basedir}/../MeteMap/target</directory>
<includes>
<include>**/*.swf</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>8.1.16.v20140903</version>
</plugin>
</plugins>
</build>
<dependencies>
<!--
<dependency>
<groupId>com.summit.mete</groupId>
<artifactId>MeteMap</artifactId>
<version>1.0</version>
<type>swf</type>
</dependency>
-->
</dependencies>
</project>
2.4. 生成FlashBuilder工程
1.4.5. 执行命令生成FlashBuilder工程
cd d:/Project/workspace/mete/MeteMap
mvn org.sonatype.flexmojos:flexmojos-maven-plugin:3.9:flashbuilder
1.4.6. 在FlashBuilder中添加模块
2.5. 生成Eclipse工程
1.4.7. 1.修改MeteWeb/pom.xml
<?xml version="1.0" encoding="utf-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>meteapp</artifactId>
<groupId>com.summit.mete</groupId>
<version>1.0</version>
</parent>
<artifactId>MeteWeb</artifactId>
<packaging>war</packaging>
<name>MeteWeb</name>
<properties>
<jdbc.host>127.0.0.1</jdbc.host>
<jdbc.port>3306</jdbc.port>
<jdbc.databaseName>ucplite</jdbc.databaseName>
<jdbc.user>root</jdbc.user>
<jdbc.password>gis</jdbc.password>
<!-- version -->
<jstl.version>1.2</jstl.version>
<junit.version>4.12</junit.version>
<spring.version>4.2.6.RELEASE</spring.version>
<servlet.version>3.0.1</servlet.version>
<jsp.version>2.2</jsp.version>
<tomcat.plugin.version>2.2</tomcat.plugin.version>
<spring.security.version>4.1.0.RELEASE</spring.security.version>
<lombok.version>1.14.8</lombok.version>
<log4j.version>1.2.17</log4j.version>
<slf4j.version>1.7.21</slf4j.version>
<org.json.version>20090211</org.json.version>
<common.dbcp.verison>1.4</common.dbcp.verison>
<commmons.pool.version>1.6</commmons.pool.version>
<commmons.collections.version>3.2.1</commmons.collections.version>
<commons.fileupload.version>1.2.1</commons.fileupload.version>
<commons.io.version>2.4</commons.io.version>
<mysql.connector.verison>5.1.6</mysql.connector.verison>
<!-- Encoding -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.encoding>UTF-8</maven.compiler.encoding>
</properties>
<build>
<sourceDirectory>src/main/java</sourceDirectory>
<testSourceDirectory>src/test/flex</testSourceDirectory>
</build>
<profiles>
<profile>
<id>devApp</id>
<build>
<finalName>MeteWeb</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>**/*</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.10</version>
<!--
<configuration>
<wtpversion>2.0</wtpversion>
<downloadSources>true</downloadSources>
<downloadJavadocs>true</downloadJavadocs>
</configuration>
-->
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>${tomcat.plugin.version}</version>
<configuration>
<port>8080</port>
<path>/gisservice</path>
<uriEncoding>UTF-8</uriEncoding>
<url>http://localhost:8080/manager/html</url>
<server>tomcat7</server>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<showWarnings>true</showWarnings>
<encoding>UTF-8</encoding>
<compilerArgs>
<arg>-parameters</arg>
</compilerArgs>
</configuration>
</plugin>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>8.1.16.v20140903</version>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>depApp</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<dependencies>
<dependency>
<groupId>com.summit.mete</groupId>
<artifactId>index</artifactId>
<version>1.0</version>
<type>swf</type>
</dependency>
</dependencies>
<build>
<finalName>MeteWeb</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>**/*</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.sonatype.flexmojos</groupId>
<artifactId>flexmojos-maven-plugin</artifactId>
<version>${flexmojos.version}</version>
<extensions>true</extensions>
<configuration>
<policyFileUrls>
<url>http://fpdownload.adobe.com/pub/swz/crossdomain.xml</url>
<url>http://fpdownload.adobe.com/pub/swz/crossdomain.xml</url>
<url>http://fpdownload.adobe.com/pub/swz/crossdomain.xml</url>
</policyFileUrls>
<rslUrls>
<url>http://fpdownload.adobe.com/pub/{extension}/flex/${flex.version}/{artifactId}_{version}.{extension}</url>
<url>http://fpdownload.adobe.com/pub/{extension}/tlf/${flex.tlf.version}/{artifactId}_${flex.tlf.version}.{extension}</url>
<url>http://fpdownload.adobe.com/pub/{extension}/flex/${flex.version}/{artifactId}_${flex.osmf.version}.{extension}</url>
</rslUrls>
</configuration>
<executions>
<execution>
<goals>
<goal>copy-flex-resources</goal>
</goals>
<configuration>
<encoding>UTF-8</encoding>
<configurationReport>false</configurationReport>
<webappDirectory>${basedir}/src/main/webapp/gis</webappDirectory>
<storepass/>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<encoding>UTF-8</encoding>
<outputDirectory>${basedir}/src/main/webapp/gis</outputDirectory>
<resources>
<resource>
<directory>${basedir}/../MeteMap/src/main/flex</directory>
<excludes>
<exclude>**/*.mxml</exclude>
<exclude>**/*.as</exclude>
<exclude>**/*.css</exclude>
</excludes>
<filtering>false</filtering>
</resource>
<resource>
<directory>${basedir}/../MeteMap/target</directory>
<includes>
<include>**/*.swf</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.10</version>
<!--
<configuration>
<wtpversion>2.0</wtpversion>
<downloadSources>true</downloadSources>
<downloadJavadocs>true</downloadJavadocs>
</configuration>
-->
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>${tomcat.plugin.version}</version>
<configuration>
<port>8080</port>
<path>/gisservice</path>
<uriEncoding>UTF-8</uriEncoding>
<url>http://localhost:8080/manager/html</url>
<server>tomcat7</server>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<showWarnings>true</showWarnings>
<encoding>UTF-8</encoding>
<!--
<compilerArgument>-parameters</compilerArgument>
-->
<compilerArgs>
<arg>-parameters</arg>
</compilerArgs>
</configuration>
</plugin>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>8.1.16.v20140903</version>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.sonatype.flexmojos</groupId>
<artifactId>flexmojos-maven-plugin</artifactId>
<versionRange>[4.2-beta,)</versionRange>
<goals>
<goal>copy-flex-resources</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore/>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>
</profiles>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<!-- JSP JSTL -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.0-b01</version>
<scope>provided</scope>
</dependency>
<!--
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>${jsp.version}</version>
<scope>provided</scope>
</dependency>
-->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>${jstl.version}</version>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.1.2</version>
<!--
<type>jar</type>
<scope>compile</scope>
-->
</dependency>
<!-- Spring -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${spring.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
<exclusions>
<!-- Exclude Commons Logging in favor of SLF4j -->
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${spring.version}</version>
</dependency>
<!-- spring webmvc相关jar包 -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>
<!-- spring security configuration -->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>${spring.security.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>${spring.security.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-taglibs</artifactId>
<version>${spring.security.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-dbcp2</artifactId>
<version>2.1.1</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-pool2</artifactId>
<version>2.4.2</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
<version>4.1</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
<version>1.11</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.4</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.2</version>
</dependency>
<!-- spring test -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
</dependency>
<!-- log4j -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j.version}</version>
<exclusions>
<exclusion>
<groupId>com.sun.jdmk</groupId>
<artifactId>jmxtools</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jmx</groupId>
<artifactId>jmxri</artifactId>
</exclusion>
</exclusions>
<!-- 将scope修改为compile 解决 软件包 org.apache.log4j 不存在问题 -->
<!-- <scope>runtime</scope> -->
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>${slf4j.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4j.version}</version>
<scope>runtime</scope>
</dependency>
<!-- org json -->
<!--
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>${org.json.version}</version>
</dependency>
-->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.5.3</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
<version>2.5.3</version>
</dependency>
<!-- mysql -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql.connector.verison}</version>
</dependency>
<dependency>
<groupId>com.vividsolutions</groupId>
<artifactId>jts</artifactId>
<version>1.13</version>
</dependency>
</dependencies>
</project>
1.4.8. 执行命令生成Eclipse工程
cd d:/Project/workspace/mete/MeteWeb
mvn eclipse:eclipse
命令执行完成后,在Eclipse中导入MeteWeb工程
1.4.9. Eclipse中MeteWeb模块调试设置
1.4.10. Eclipse中MeteApp工程编译打包设置
3. Maven技术参照
http://maven.apache.org/ref/3.0.3/maven-model/apidocs/index.html
http://maven.apache.org/guides/introduction/introduction-todependency-mechanism.html
3.1. 内部变量
${project.name} |
||
${project.parent.groupId} |
||
${project.build.sourceEncoding} |
||
${settings.localRepository} |
||
${env.JAVA_HOME}; |
||
${java.class.path} |
||
${java.version} |
||
${user.home} |
||
${user.name} |
||
3.2. 常用插件
phase |
goals |
||
maven-compiler-plugin |
Maven compiler plugin |
Maven core phases (clean, compile, test, and so on.) |
compiler:compile compiler:testCompile |
maven-surefire-plugin |
run unit tests |
test |
surefire:test |
maven-enforcer-plugin |
define environmental conditions |
validate |
enforcer:enforce enforcer:display-info |
maven-war-plugin |
redefined in our web POMs |
||
maven-checkstyle-plugin |
|||