我有一个Maven项目工作正常,直到我在src/main/webapps/resources
中添加了一些新的静态资源文件。
此目录已包含子目录js
,img
和css
,现在我添加了一个新的子目录instructions
,其中我添加了3个pdf文件,这些文件是可从部署的应用程序下载。
当我运行mvn构建时,我现在得到了这个异常:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.1.1:war (default-war) on project jpa:
Error assembling WAR: resources/instructions/entrance.pdf not found. -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException:
Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.1.1:war (default-war) on project jpa:
Error assembling WAR: resources/instructions/entrance.pdf not found.
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.MojoExecutor.executeForkedExecutions(MojoExecutor.java:365)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:199)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
似乎在抱怨我刚添加的其中一个文件不存在,当它肯定 时,为什么会这样?其次,它为什么要关心?
修改
pom.xml
补充道。许多依赖项被省略,否则它很长。
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>nick</groupId>
<artifactId>jpa</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>jpa</name>
<properties>
<spring.version>4.0.0.RELEASE</spring.version>
<mysql.version>5.1.27</mysql.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
<version>1.4.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>
<!-- many dependencies omitted for brevity -->
</dependencies>
<build>
<filters>
<filter>src/main/filters/${profile.id}.properties</filter>
</filters>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>dev</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<configuration>
<url>http://localhost:8080/manager/text</url>
<server>tomcat8080</server>
<path>/</path>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<profile.id>dev</profile.id>
</properties>
</profile>
</profiles>
</project>