maven build从resources目录生成空文件
我有一个名为common的模块,它在src/main/resources dir下有一个test1.txt文件。我只是在构建项目,并检入common的target/class dir文件test1.txt为空。我不知道为什么会有这种行为 我尝试更改文件名,但它不会影响输出。文件仍然是空的,里面没有任何内容 我的父母pom如下所示maven build从resources目录生成空文件,maven,Maven,我有一个名为common的模块,它在src/main/resources dir下有一个test1.txt文件。我只是在构建项目,并检入common的target/class dir文件test1.txt为空。我不知道为什么会有这种行为 我尝试更改文件名,但它不会影响输出。文件仍然是空的,里面没有任何内容 我的父母pom如下所示 <?xml version="1.0" encoding="UTF-8"?> <project xmlns=&
<?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>com.test</groupId>
<artifactId>test1</artifactId>
<packaging>pom</packaging>
<version>1.0.0</version>
<modules>
<module>common</module>
</modules>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<scala.version>2.12.10</scala.version>
<scala.compatible.version>2.12</scala.compatible.version>
<spark.version>3.0.0</spark.version>
</properties>
<dependencies>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>${scala.version}</version>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_${scala.compatible.version}</artifactId>
<version>${spark.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-sql_${scala.compatible.version}</artifactId>
<version>${spark.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
</dependencyManagement>
<profiles>
<profile>
<id>dev</id>
<properties>
<env>dev</env>
<s3_deploy_dir>${s3_deploy_dir}</s3_deploy_dir>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
<profile>
<id>prod</id>
<properties>
<env>prod</env>
</properties>
</profile>
</profiles>
<build>
<sourceDirectory>src/main/scala</sourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<minimizeJar>true</minimizeJar>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.scala-tools</groupId>
<artifactId>maven-scala-plugin</artifactId>
<version>2.15.2</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
</project>
4.0.0
com.test
测试1
聚甲醛
1.0.0
常见的
8.
8.
2.12.10
2.12
3.0.0
org.scala-lang
scala图书馆
${scala.version}
org.apache.spark
spark-core{scala.compatible.version}
${spark.version}
假如
org.apache.spark
spark-sql{scala.compatible.version}
${spark.version}
假如
发展
发展
${s3_deploy_dir}
真的
戳
戳
src/main/scala
org.apache.maven.plugins
maven阴影插件
3.2.4
包裹
阴凉处
真的
*:*
META-INF/*.SF
META-INF/*.DSA
META-INF/*.RSA
org.scala-tools
maven scala插件
2.15.2
编译
测试编译
src/main/resources
真的
我的commond模块的pom如下所示
<?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">
<parent>
<artifactId>test1</artifactId>
<groupId>com.test</groupId>
<version>1.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>common</artifactId>
<dependencies>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_${scala.compatible.version}</artifactId>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-sql_${scala.compatible.version}</artifactId>
</dependency>
</dependencies>
</project>
测试1
com.test
1.0.0
4.0.0
常见的
org.apache.spark
spark-core{scala.compatible.version}
org.apache.spark
spark-sql{scala.compatible.version}
您能从通用模块中显示pom.xml吗?当然可以。编辑问题