maven二三事

一个有用的命令:
引用
mvn -U clean eclipse:clean eclipse:m2eclipse -DdownloadSources=true -Declipse.addVersionToProjectName=true
Declipse.addVersionToProjectName=true 这个参数把项目的版本添加到工程名里面了

一个常用的插件, 使用jdk1.5编译, maven默认采用1.4, sigh:
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>2.0.2</version>
        <configuration>
          <source>1.5</source>
          <target>1.5</target>
          <encoding>GBK</encoding>
        </configuration>
      </plugin> 


一个常被忽略的配置, 将java目录下的xml, properties文件打包到class中:
 
<build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <includes>
                    <include>**/*</include>
                </includes>
                <filtering>true</filtering>
            </resource>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.xml</include>
                    <include>**/*.properties</include>
                </includes>
            </resource>
        </resources>
    </build>


你可能感兴趣的:(java,eclipse,maven,xml)