- pom配置基本如下:
<!-- 打包的机制,如pom,jar, maven-plugin, ejb, war, ear, rar, par,默认为jar -->
<packaging>war</packaging>
定义常量,可采用${jdk.version}的方式引用
- 配置jar包依赖配置:可在百度搜索maven repository,如下图:
选择需要的版本后进行如下图的复制即可:
- 配置相关项目配置文件包作为启动项目的配置文件
<profiles>
<profile>
<id>configFile</id>
<properties>
<profile.dir>${profiles.dir}/configFile</profile.dir>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
</profiles>
4.构建配置
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
<resource>
<filtering>true</filtering>
<directory>${profile.dir}</directory>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
<encoding>${project.build.sourceEncoding}</encoding>
<skipTests>true</skipTests>
</configuration>
</plugin>
<!-- <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId>
<version>2.6</version> <configuration> <failOnMissingWebXml>false</failOnMissingWebXml>
</configuration> </plugin> -->
</plugins>
<finalName>${appname}</finalName>
</build>