我们正在开发一个多模块Maven项目,在一个子项目中我们有一些资源文件(免费标记模板文件)。当我们根据操作系统创建项目的EAR时,Maven正在更新模板文件中的行分隔符
如果我们在Windows上运行mvn install它会保留行分隔符,当我们在linux上运行它时,它将行分隔符更改为。
模板是在Windows机器上创建的,并且具有默认分隔符,即使我们在windows / linux上构建项目,我们也不希望Maven进行更改。代码总是部署在Windows机器上,遇到linux行分隔符时失败
有没有办法告诉Maven不要搞乱线分隔符?
Project POM看起来像
<project>
<parent>
<groupId>com.xyz</groupId>
<artifactId>Foo</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>FooBatch</artifactId>
<packaging>jar</packaging>
<properties>
<spring-version>4.1.4.RELEASE</spring-version>
</properties>
<dependencies>
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
<version>2.3.21</version>
</dependency>
// and more dependencies
</dependencies>
</project>
这里是父POM
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.xyz</groupId>
<artifactId>Foo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>FooBatch</module>
<module>FooEJB</module>
<module>FooEAR</module>
</modules>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<!-- http://maven.apache.org/plugins/maven-compiler-plugin/ -->
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<!-- skips surefire tests without skipping failsafe tests. Property
value seems to magically default to false -->
<skipTests>${skipUnitTests}</skipTests>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.18.1</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
<reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
<argLine>${jacoco.agent.arg}</argLine>
</configuration>
</execution>
</executions>
<configuration>
<!-- skips failsafe tests without skipping surefire tests. Property
value seems to magically default to false -->
<skipITs>${skipITTests}</skipITs>
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.2.201409121644</version>
<executions>
<execution>
<id>jacoco-initialize</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>jacoco-site</id>
<phase>package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
答案 0 :(得分:0)
尝试将以下内容添加到您的父pom。
<project>
...
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>