Java Maven:资源复制文件
我正在使用maven resources将我的main/src/resources复制到我的目标文件夹。问题是,一旦我将项目打包到Jar中,资源中的每个文件都会出现两次:Java Maven:资源复制文件,java,maven,maven-plugin,Java,Maven,Maven Plugin,我正在使用maven resources将我的main/src/resources复制到我的目标文件夹。问题是,一旦我将项目打包到Jar中,资源中的每个文件都会出现两次: target/MYPROJECT.jar/主要/资源 target/MYPROJECT.jar/ 我的pom.xml仍然是: <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-in
<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>xxxx</groupId>
<artifactId>xxxx</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>QuerySuggester</name>
<profiles>
</profiles>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<build>
<finalName>query-suggester</finalName>
<sourceDirectory>src</sourceDirectory>
<resources>
<resource>
<directory>src</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>**/*</include>
</includes>
<!-- <excludes> -->
<!-- <exclude>wn31/*</exclude> -->
<!-- </excludes> -->
</resource>
<resource>
<directory>src/main/scripts</directory>
<filtering>true</filtering>
<includes>
<include>**/*</include>
</includes>
</resource>
<!-- <resource> -->
<!-- <directory>apps</directory> -->
<!-- <excludes> -->
<!-- <exclude>*</exclude> -->
<!-- </excludes> -->
<!-- </resource> -->
</resources>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<!-- The configuration of maven-assembly-plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2.2</version>
<!-- The configuration of the plugin -->
<configuration>
<!-- Specifies the configuration file of the assembly plugin -->
<descriptors>
<descriptor>src/main/assembly/assembly.xml</descriptor>
</descriptors>
<finalName>QuerySuggester</finalName>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>java</executable>
<mainClass>xxxx</mainClass>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.4</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<excludes>
<exclude>**/wn31</exclude>
</excludes>
<archive>
<manifest>
<addClasspath>true</addClasspath>
xxx</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.1</version>
<!-- The configuration of the plugin -->
<configuration>
<!-- Configuration of the archiver -->
<archive>
<!-- Manifest specific configuration -->
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
<!-- Specifies the main class of the application -->
<mainClass>xxx</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
....
</dependencies>
4.0.0
xxxx
xxxx
0.0.1-快照
质询建议者
UTF-8
UTF-8
查询建议器
src
src
**/*.爪哇
src/main/resources
符合事实的
**/*
src/main/scripts
符合事实的
**/*
maven编译器插件
3.1
1.6
1.6
org.apache.maven.plugins
maven汇编插件
2.2.2
src/main/assembly/assembly.xml
质询建议者
org.codehaus.mojo
execmaven插件
1.2.1
JAVA
JAVA
xxxx
org.apache.maven.plugins
maven资源插件
2.4
UTF-8
org.apache.maven.plugins
maven jar插件
**/wn31
符合事实的
xxx
org.apache.maven.plugins
maven jar插件
2.3.1
符合事实的
解放党/
xxx
....
我尝试使用by If避免在第二个位置复制这些文件。项目将不起作用,所以我应该从第一个位置删除它
有什么想法吗
编辑1:首先显示完整的pom.xml请显示完整的pom文件,而不仅仅是摘录。此外,您是否尝试过
mvn clean软件包
?好的,添加了完整的pom.xml