简介:
什么是POM?
POM是项目对象模型(Project Object Model)的简称,它是Maven项目中的文件,使用XML表示,名称叫做pom.xml。在Maven中,当谈到Project的时候,不仅仅是一堆包含代码的文件。一个Project往往包含一个配置文件,包括了与开发者有关的,缺陷跟踪系统,组织与许可,项目的URL,项目依赖,以及其他。它包含了所有与这个项目相关的东西。事实上,在Maven世界中,project可以什么都没有,甚至没有代码,但是必须包含pom.xml文件。
概览
下面是一个POM项目中的pom.xml文件中包含的元素。注意,其中的modelVersion是4.0.0,这是当前仅有的可以被Maven2&3同时支持的POM版本,它是必须的。
- <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/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <!-- 基本设置 -->
- <groupId>...</groupId>
- <artifactId>...</artifactId>
- <version>...</version>
- <packaging>...</packaging>
- <dependencies>...</dependencies>
- <parent>...</parent>
- <dependencyManagement>...</dependencyManagement>
- <modules>...</modules>
- <properties>...</properties>
- <!-- 构建过程的设置 -->
- <build>...</build>
- <reporting>...</reporting>
- <!-- 项目信息设置 -->
- <name>...</name>
- <description>...</description>
- <url>...</url>
- <inceptionYear>...</inceptionYear>
- <licenses>...</licenses>
- <organization>...</organization>
- <developers>...</developers>
- <contributors>...</contributors>
- <!-- 环境设置 -->
- <issueManagement>...</issueManagement>
- <ciManagement>...</ciManagement>
- <mailingLists>...</mailingLists>
- <scm>...</scm>
- <prerequisites>...</prerequisites>
- <repositories>...</repositories>
- <pluginRepositories>...</pluginRepositories>
- <distributionManagement>...</distributionManagement>
- <profiles>...</profiles>
- </project>
基本的设置:
POM包含了一个project所需要的所有信息,当然也就包含了构建过程中所需要的插件的配置信息,事实上,这里申明了"who","what",和"where",然而构建生命周期(build lifecycle)s中说的是"when"和"how"。这并不是说POM并能影响生命周期的过程-事实上它可以。例如,配置一个可以嵌入ant任务到POM的mavem-antrun-plugin。它基本上就是一个声明。就像build.xml告诉ant当运行时它该做什么一样,一个POM申明了它自己的配置。如果外力迫使生命周期跳过了ant插件的执行,这并不影响那些已经执行过的插件产生的效果。这一点和build.xml不一样。
Maven坐标
上面的POM定义的是Maven2&3都承认的最小部分。groupId:artifactId:version是必须的字段(尽管在继承中groupId和version不需要明确指出)。这三个字段就像地址和邮戳,它标记了仓库中的特定位置,就像Maven projects的坐标系统一样。
JEEWEB详细配置如下:
- <?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/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <groupId>html580.jeeweb</groupId>
- <artifactId>jeeweb</artifactId>
- <packaging>war</packaging>
- <version>1.0-SNAPSHOT</version>
- <name>jeeweb</name>
- <url>https://github.com/html580/JEEWEB</url>
- <organization>
- <name>jeeweb</name>
- <url>http://bbs.html580.com/forum.php?gid=47</url>
- </organization>
- <!-- 设定除中央仓库(repo1.maven.org/maven2/)外的其他仓库,按设定顺序进行查找. -->
- <repositories>
- <!-- 如有Nexus私服, 取消注释并指向正确的服务器地址.
- <repository>
- <id>nexus-repos</id>
- <name>Team Nexus Repository</name>
- <url>http://localhost:8081/nexus/content/groups/public</url>
- </repository>-->
- <repository>
- <id>apache-repo</id>
- <name>apache Repository</name>
- <url>https://repository.apache.org/content/groups/public/</url>
- </repository>
- <repository>
- <id>java-repo</id>
- <name>java Repository</name>
- <url>http://download.java.net/maven/2/</url>
- </repository>
- <repository>
- <id>springsource-repo</id>
- <name>SpringSource Repository</name>
- <url>http://repo.spring.io/release/</url>
- </repository>
- <repository>
- <id>springsource-repo-snapshot</id>
- <name>SpringSource Repository</name>
- <url>http://repo.spring.io/snapshot/</url>
- </repository>
- <repository>
- <id>cloudhopper</id>
- <name>Repository for Cloudhopper</name>
- <url>http://maven.cloudhopper.com/repos/third-party/</url>
- </repository>
- <repository>
- <id>jboss-repo-releases</id>
- <name>Jboss Repository</name>
- <url>https://repository.jboss.org/nexus/content/repositories/releases/</url>
- </repository>
- <repository>
- <id>central</id>
- <name>Maven Repository Switchboard</name>
- <layout>default</layout>
- <url>http://repo.maven.apache.org/maven2</url>
- </repository>
- <repository>
- <id>maven-repo1</id>
- <name>maven-repo1</name>
- <layout>default</layout>
- <url>http://repo1.maven.org/maven2/</url>
- </repository>
- <repository>
- <id>sourceforge-releases</id>
- <name>Sourceforge Releases</name>
- <url>https://oss.sonatype.org/content/repositories/sourceforge-releases/</url>
- </repository>
- </repositories>
- <!-- 开发人员信息 -->
- <developers>
- <developer>
- <name>dengzhifeng</name>
- <email>280160522@qq.com</email>
- <url>http://www.html580.com</url>
- <roles>
- <role>software engineer</role>
- </roles>
- <timezone>8</timezone>
- </developer>
- </developers>
- <!--许可证 -->
- <licenses>
- <license>
- <name>Apache License, Version 2.0</name>
- <url>http://www.apache.org/licenses/LICENSE-2.0</url>
- </license>
- </licenses>
- <!-- 问题反馈信息 -->
- <issueManagement>
- <system>JEEWEB</system>
- <url>http://bbs.html580.com/forum.php?gid=47</url>
- </issueManagement>
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <!-- version setting -->
- <asm.version>4.2</asm.version>
- <cglib.version>3.1</cglib.version>
- <commons-lang3.version>3.1</commons-lang3.version>
- <common-collections4.version>4.0</common-collections4.version>
- <commons-io.version>2.4</commons-io.version>
- <guava.version>15.0</guava.version>
- <common.fileupload.version>1.3</common.fileupload.version>
- <common.compress.version>1.6</common.compress.version>
- <ant.version>1.9.2</ant.version>
- <junit.version>4.11</junit.version>
- <mockito.version>1.9.5</mockito.version>
- <powermock.version>1.5.2</powermock.version>
- <h2.version>1.3.174</h2.version>
- <jetty.version>8.1.8.v20121106</jetty.version>
- <servlet.version>3.0.1</servlet.version>
- <jsp.version>2.2</jsp.version>
- <jstl.version>1.2</jstl.version>
- <standard.version>1.1.2</standard.version>
- <aspectj.version>1.7.4</aspectj.version>
- <spring.version>4.0.0.RELEASE</spring.version>
- <spring.data.jpa.version>1.4.1.RELEASE</spring.data.jpa.version>
- <hibernate.core.version>4.3.0.Final</hibernate.core.version>
- <hibernate.ehcache.version>4.3.0.Final</hibernate.ehcache.version>
- <hibernate.commons.annotaions.version>4.0.4.Final</hibernate.commons.annotaions.version>
- <hibernate.validator.version>5.0.2.Final</hibernate.validator.version>
- <javassist.version>3.18.0-GA</javassist.version>
- <ehcache.core.version>2.6.6</ehcache.core.version>
- <shiro.version>1.2.2</shiro.version>
- <slf4j.version>1.7.5</slf4j.version>
- <logback.version>1.0.13</logback.version>
- <druid.version>0.2.23</druid.version>
- <fastjson.version>1.1.34</fastjson.version>
- <httpclient.version>4.3.1</httpclient.version>
- <dom4j.version>1.6.1</dom4j.version>
- <joda-time.version>2.3</joda-time.version>
- <prettytime.version>3.2.3.Final</prettytime.version>
- <jcaptcha.version>2.0-alpha-1</jcaptcha.version>
- <jsoup.version>1.7.3</jsoup.version>
- <!-- mysql driver setting -->
- <jdbc.driver.groupId>mysql</jdbc.driver.groupId>
- <jdbc.driver.artifactId>mysql-connector-java</jdbc.driver.artifactId>
- <jdbc.driver.version>5.1.13</jdbc.driver.version>
- <!-- oracle driver setting
- <jdbc.driver.groupId>com.oracle</jdbc.driver.groupId>
- <jdbc.driver.artifactId>ojdbc14</jdbc.driver.artifactId>
- <jdbc.driver.version>10.2.0.1.0</jdbc.driver.version> -->
- <!-- mssql driver setting
- <jdbc.driver.groupId>net.sourceforge.jtds</jdbc.driver.groupId>
- <jdbc.driver.artifactId>jtds</jdbc.driver.artifactId>
- <jdbc.driver.version>1.2.4</jdbc.driver.version> -->
- <!-- other setting -->
- <jdk.version>1.6</jdk.version>
- <tomcat.version>2.1</tomcat.version>
- <jetty.version>7.6.10.v20130312</jetty.version>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- </properties>
- <!-- 依赖项定义 -->
- <dependencies>
- <!-- 测试相关jar包 -->
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>${junit.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-all</artifactId>
- <version>${mockito.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-test</artifactId>
- <version>${spring.version}</version>
- </dependency>
- <dependency>
- <groupId> com.h2database</groupId>
- <artifactId>h2</artifactId>
- <version>${h2.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-server</artifactId>
- <version>${jetty.version}</version>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <artifactId>javax.servlet</artifactId>
- <groupId>org.eclipse.jetty.orbit</groupId>
- </exclusion>
- </exclusions>
- </dependency>
- <!-- cglib asm 相关jar包-->
- <dependency>
- <groupId>cglib</groupId>
- <artifactId>cglib</artifactId>
- <version>${cglib.version}</version>
- </dependency>
- <dependency>
- <groupId>org.ow2.asm</groupId>
- <artifactId>asm</artifactId>
- <version>${asm.version}</version>
- </dependency>
- <!-- utils 相关jar包 -->
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-lang3</artifactId>
- <version>${commons-lang3.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-collections4</artifactId>
- <version>${common-collections4.version}</version>
- </dependency>
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- <version>${guava.version}</version>
- </dependency>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- <version>${commons-io.version}</version>
- </dependency>
- <dependency>
- <groupId>commons-codec</groupId>
- <artifactId>commons-codec</artifactId>
- <version>1.7</version>
- </dependency>
- <dependency>
- <groupId>commons-beanutils</groupId>
- <artifactId>commons-beanutils</artifactId>
- <version>1.8.3</version>
- <exclusions>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>commons-fileupload</groupId>
- <artifactId>commons-fileupload</artifactId>
- <version>${common.fileupload.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-compress</artifactId>
- <version>${common.compress.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.ant</groupId>
- <artifactId>ant</artifactId>
- <version>${ant.version}</version>
- <exclusions>
- <exclusion>
- <artifactId>ant-launcher</artifactId>
- <groupId>org.apache.ant</groupId>
- </exclusion>
- </exclusions>
- </dependency>
- <!-- data source 相关jar包-->
- <dependency>
- <groupId>com.alibaba</groupId>
- <artifactId>druid</artifactId>
- <version>${druid.version}</version>
- </dependency>
- <!-- jdbc driver -->
- <dependency>
- <groupId>${jdbc.driver.groupId}</groupId>
- <artifactId>${jdbc.driver.artifactId}</artifactId>
- <version>${jdbc.driver.version}</version>
- <scope>runtime</scope>
- </dependency>
- <!-- 日志相关jar包 -->
- <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>
- </dependency>
- <dependency>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-classic</artifactId>
- <version>${logback.version}</version>
- </dependency>
- <!-- web相关jar包 -->
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>javax.servlet-api</artifactId>
- <version>${servlet.version}</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>taglibs</groupId>
- <artifactId>standard</artifactId>
- <version>${standard.version}</version>
- </dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>jstl</artifactId>
- <version>${jstl.version}</version>
- </dependency>
- <!-- aspectj相关jar包-->
- <dependency>
- <groupId>org.aspectj</groupId>
- <artifactId>aspectjrt</artifactId>
- <version>${aspectj.version}</version>
- </dependency>
- <dependency>
- <groupId>org.aspectj</groupId>
- <artifactId>aspectjweaver</artifactId>
- <version>${aspectj.version}</version>
- </dependency>
- <!-- spring相关jar包 -->
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-context</artifactId>
- <version>${spring.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-context-support</artifactId>
- <version>${spring.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-jdbc</artifactId>
- <version>${spring.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-orm</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 jpa -->
- <dependency>
- <groupId>org.springframework.data</groupId>
- <artifactId>spring-data-jpa</artifactId>
- <version>${spring.data.jpa.version}</version>
- <exclusions>
- <exclusion>
- <artifactId>jcl-over-slf4j</artifactId>
- <groupId>org.slf4j</groupId>
- </exclusion>
- </exclusions>
- </dependency>
- <!-- hibernate相关jar包 -->
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-core</artifactId>
- <version>${hibernate.core.version}</version>
- <exclusions>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- <exclusion>
- <groupId>javassist</groupId>
- <artifactId>javassist</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-entitymanager</artifactId>
- <version>${hibernate.core.version}</version>
- </dependency>
- <dependency>
- <groupId>org.javassist</groupId>
- <artifactId>javassist</artifactId>
- <version>${javassist.version}</version>
- <exclusions>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-ehcache</artifactId>
- <version>${hibernate.ehcache.version}</version>
- <exclusions>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- <exclusion>
- <artifactId>ehcache-core</artifactId>
- <groupId>net.sf.ehcache</groupId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.hibernate.common</groupId>
- <artifactId>hibernate-commons-annotations</artifactId>
- <version>${hibernate.commons.annotaions.version}</version>
- <exclusions>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate</artifactId>
- </exclusion>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <!-- hibernate validator 相关jar包 -->
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-validator</artifactId>
- <version>${hibernate.validator.version}</version>
- </dependency>
- <!-- apache shiro 相关jar包 -->
- <dependency>
- <groupId>org.apache.shiro</groupId>
- <artifactId>shiro-core</artifactId>
- <version>${shiro.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.shiro</groupId>
- <artifactId>shiro-web</artifactId>
- <version>${shiro.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.shiro</groupId>
- <artifactId>shiro-aspectj</artifactId>
- <version>${shiro.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.shiro</groupId>
- <artifactId>shiro-ehcache</artifactId>
- <version>${shiro.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.shiro</groupId>
- <artifactId>shiro-spring</artifactId>
- <version>${shiro.version}</version>
- </dependency>
- <!--<dependency>-->
- <!--<groupId>org.apache.shiro</groupId>-->
- <!--<artifactId>shiro-quartz</artifactId>-->
- <!--<version>${shiro.version}</version>-->
- <!--<exclusions>-->
- <!--<exclusion>-->
- <!--<artifactId>quartz</artifactId>-->
- <!--<groupId>org.opensymphony.quartz</groupId>-->
- <!--</exclusion>-->
- <!--</exclusions>-->
- <!--</dependency>-->
- <!-- quartz -->
- <!--<dependency>-->
- <!--<groupId>org.quartz-scheduler</groupId>-->
- <!--<artifactId>quartz</artifactId>-->
- <!--<version>${quartz.version}</version>-->
- <!--<exclusions>-->
- <!--<exclusion>-->
- <!--<artifactId>c3p0</artifactId>-->
- <!--<groupId>c3p0</groupId>-->
- <!--</exclusion>-->
- <!--</exclusions>-->
- <!--</dependency>-->
- <!-- encache 相关jar包 -->
- <dependency>
- <groupId>net.sf.ehcache</groupId>
- <artifactId>ehcache-core</artifactId>
- <version>${ehcache.core.version}</version>
- <scope>compile</scope>
- <exclusions>
- <exclusion>
- <artifactId>slf4j-api</artifactId>
- <groupId>org.slf4j</groupId>
- </exclusion>
- </exclusions>
- </dependency>
- <!-- json 相关jar包 -->
- <dependency>
- <groupId>com.alibaba</groupId>
- <artifactId>fastjson</artifactId>
- <version>${fastjson.version}</version>
- </dependency>
- <!-- 安全相关jar包 -->
- <!-- httpclient相关jar包 -->
- <dependency>
- <groupId>org.apache.httpcomponents</groupId>
- <artifactId>httpclient</artifactId>
- <version>${httpclient.version}</version>
- <exclusions>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <!--dom4j-->
- <dependency>
- <groupId>dom4j</groupId>
- <artifactId>dom4j</artifactId>
- <version>${dom4j.version}</version>
- <exclusions>
- <exclusion>
- <groupId>xml-apis</groupId>
- <artifactId>xml-apis</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <!-- 时间相关 -->
- <!--日期美化-->
- <dependency>
- <groupId>org.ocpsoft.prettytime</groupId>
- <artifactId>prettytime</artifactId>
- <version>${prettytime.version}</version>
- </dependency>
- <!-- joda time 相关jar包 -->
- <dependency>
- <groupId>joda-time</groupId>
- <artifactId>joda-time</artifactId>
- <version>${joda-time.version}</version>
- </dependency>
- <!-- jcaptcha 验证码 -->
- <dependency>
- <groupId>com.octo.captcha</groupId>
- <artifactId>jcaptcha</artifactId>
- <version>${jcaptcha.version}</version>
- </dependency>
- <dependency>
- <groupId>com.octo.captcha</groupId>
- <artifactId>jcaptcha-integration-simple-servlet</artifactId>
- <version>${jcaptcha.version}</version>
- <exclusions>
- <exclusion>
- <artifactId>servlet-api</artifactId>
- <groupId>javax.servlet</groupId>
- </exclusion>
- </exclusions>
- </dependency>
- <!-- html处理jar包 -->
- <dependency>
- <groupId>org.jsoup</groupId>
- <artifactId>jsoup</artifactId>
- <version>${jsoup.version}</version>
- </dependency>
- </dependencies>
- <build>
- <outputDirectory>${project.basedir}/src/main/webapp/WEB-INF/classes/</outputDirectory>
- <plugins>
- <!-- Compiler 插件, 设定JDK版本 -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>2.5.1</version>
- <configuration>
- <source>${jdk.version}</source>
- <target>${jdk.version}</target>
- <showWarnings>true</showWarnings>
- </configuration>
- </plugin>
- <!-- war 打包插件, 设定war包名称不带版本号 -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-war-plugin</artifactId>
- <version>2.3</version>
- <configuration>
- <warName>${project.artifactId}</warName>
- </configuration>
- </plugin>
- <!-- Eclipse 插件 -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-eclipse-plugin</artifactId>
- <version>2.9</version>
- <configuration>
- <downloadSources>false</downloadSources>
- <downloadJavadocs>false</downloadJavadocs>
- <wtpversion>2.0</wtpversion>
- <!-- 增加设置项目encoding的文件 -->
- <additionalConfig>
- <file>
- <name>.settings/org.eclipse.core.resources.prefs</name>
- <content>
- <![CDATA[eclipse.preferences.version=1${line.separator}encoding/<project>=${project.build.sourceEncoding}${line.separator}]]>
- </content>
- </file>
- </additionalConfig>
- <additionalProjectnatures>
- <projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>
- </additionalProjectnatures>
- </configuration>
- </plugin>
- <!-- tomcat6插件 -->
- <plugin>
- <groupId>org.apache.tomcat.maven</groupId>
- <artifactId>tomcat6-maven-plugin</artifactId>
- <version>${tomcat.version}</version>
- <configuration>
- <path>/${project.artifactId}</path>
- </configuration>
- </plugin>
- <!-- tomcat7插件 -->
- <plugin>
- <groupId>org.apache.tomcat.maven</groupId>
- <artifactId>tomcat7-maven-plugin</artifactId>
- <version>${tomcat.version}</version>
- <configuration>
- <path>/${project.artifactId}</path>
- </configuration>
- </plugin>
- <!-- jetty插件 -->
- <plugin>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jetty-maven-plugin</artifactId>
- <version>${jetty.version}</version>
- <configuration>
- <webAppConfig>
- <contextPath>/${project.artifactId}</contextPath>
- </webAppConfig>
- </configuration>
- </plugin>
- <!-- resource插件 -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-resources-plugin</artifactId>
- <version>2.6</version>
- </plugin>
- <!-- install插件 -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-install-plugin</artifactId>
- <version>2.4</version>
- </plugin>
- <!-- clean插件 -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-clean-plugin</artifactId>
- <version>2.5</version>
- </plugin>
- <!-- ant插件 -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-antrun-plugin</artifactId>
- <version>1.7</version>
- </plugin>
- <!-- dependency插件 -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <version>2.5.1</version>
- </plugin>
- </plugins>
- </build>
- </project>
转自: http://bbs.html580.com/forum.php?mod=viewthread&tid=178107&extra=page%3D1
相关推荐
接下来,我们需要在Myeclipse2013中集成maven,包括新建maven本地库、配置settings.xml文件和添加maven安装包。在配置settings.xml文件时,我们需要添加localRepository节点,以指定maven本地库的路径。 在搭建好...
- 在新创建的Maven项目中,打开`pom.xml`文件。这是Maven项目的配置中心,你需要在此定义项目依赖、插件等。 - 添加Web应用所需的依赖,例如`javax.servlet`的`servlet-api`库,以及你的Web框架(如Spring MVC、...
而Struts2是一个基于MVC(Model-View-Controller)架构的Web框架,它的配置文件struts2.xml用于定义动作映射、结果页面、拦截器等。例如: ```xml <action name="hello" class="com.example.HelloWorldAction">...
工具可能包括构建脚本(如Maven或Gradle)、配置文件(如pom.xml或build.gradle)、服务器配置(如Tomcat或JBoss)等。 在“ProJee6”的压缩包子文件中,我们可以期待看到以下内容: 1. **源代码文件**:Java类、...
编写Mapper接口和对应的XML配置文件,定义SQL语句和结果映射。 7. **创建数据库连接** 配置数据源,通常在`spring-context.xml`中,使用`jee:jndi-lookup`或`bean`标签。如果使用`mybatis-spring`,还需要配置...
3. **配置Spring MVC**:创建`servlet-context.xml`配置文件,定义DispatcherServlet的配置,包括视图解析器、包扫描等。 ```xml <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi=...
对于数据库连接,我们还需要在Maven的资源配置中添加数据源,并在MyBatis的配置文件(mybatis-config.xml)中指定Mapper接口的扫描路径。 最后,为了能在Eclipse中直接运行项目,我们需要确保项目的JDK版本与SSM...
4. **配置Mybatis**:创建Mybatis的全局配置文件`mybatis-config.xml`和Mapper接口及对应的XML映射文件,确保Mybatis-Spring整合配置正确。 5. **编写代码**:根据项目需求,编写业务逻辑、服务接口、数据访问对象...
- **pom.xml**:Maven项目的核心配置文件,用于定义项目依赖、构建目标等信息。 - **Web模块**:指项目的Web部分,包括HTML、CSS、JavaScript以及Servlet等Web相关的资源。 - **动态Web模块**:表示项目可以作为一个...
通过`init-param`配置,指定了Spring MVC的配置文件路径,这里不在默认的`WEB-INF`目录下,而是自定义到了`src/main/resources/spring/web/servlet-context.xml`。 4. **配置servlet-context.xml**: `servlet-...
3. **Maven或Gradle构建文件**:如`pom.xml`或`build.gradle`,定义项目依赖和构建过程。 4. **Web应用目录**:包括`WEB-INF/web.xml`(Web应用配置)、视图解析器配置(如`jsp`页面或Thymeleaf模板)等。 5. **...
**四、Maven配置** 在`pom.xml`中,你需要配置`spring-boot-starter-parent`和`spring-boot-starter-web`。前者提供了依赖管理,后者则包含Web开发所需的组件。例如: ```xml <groupId>org.springframework.boot...
整合SSM框架需要配置多个文件,以下是一些关键配置文件及其作用: **web.xml** - 配置监听器和过滤器,初始化SpringMVC。 - 设置SpringMVC前端控制器DispatcherServlet。 **spring-mvc.xml** - 配置SpringMVC相关...
在配置文件中,如applicationContext.xml,定义了Spring应用上下文的配置,包括bean、jee、tx和context命名空间的引用,遵循Spring的XML配置标准。这个配置文件是Spring应用程序的核心,用于定义组件的依赖关系和...
创建一个名为`applicationContext.xml`的配置文件,用于定义 Redis 配置以及 RedisTemplate 和 StringRedisTemplate 实例。以下是一个基本的配置示例: ```xml <?xml version="1.0" encoding="UTF-8"?> ...
- 部署描述符编辑器:编辑`web.xml`、`pom.xml`等配置文件。 5. **Web开发工具**: - JavaScript和HTML编辑器:支持前端开发,包括语法高亮、代码提示和错误检查。 - CSS编辑器:用于编辑样式表,提供实时预览...
6. **项目结构**:“Cinderella-master”可能代表项目的源代码仓库,通常包含src/main/java目录用于放置Java源码,src/main/resources存放资源配置文件,以及pom.xml文件,这是Maven的项目对象模型文件,定义了项目...
Maven 的 POM.xml 文件中,可以通过添加 SpringBoot 的 Starters 来引入所需的依赖。 总结,SpringBoot 是 Spring 框架的扩展,通过自动化配置和简化构建过程,极大地提高了开发效率。结合 Maven 或 Gradle,...
2. 配置文件:如web.xml(Servlet配置)、pom.xml(Maven项目配置)或build.gradle(Gradle项目配置)。 3. 测试文件夹:包含了单元测试和集成测试的代码。 4. 数据库脚本:创建数据库表和初始数据的SQL文件。 5. ...