-1
網絡資源不會被複制到目標/類文件夾,因此不會被複制到target/$ {finalName}/WEB-INF/classes文件夾中。將webapp資源轉換爲目標
此刻從mvn clean install
輸出:
target/classes/(src/main/java)
但是我也試圖讓:
target/classes/(src/main/webapp)
POM:
<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>StrategicTestArchitecture</groupId>
<artifactId>STATestAPI</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.0.0</version>
<!-- <configuration>
<warSourceDirectory>src/main/webapp</warSourceDirectory>
<warSourceDirectory>WebContent</warSourceDirectory>
<webResouces>
<resource>
<directory>src/main/webapp</directory>
<targetPath>WEB-INF/classes</targetPath>
</resource>
<resource>
<directory>${baseDir}/src/main/webapp</directory>
<targetPath>target/${finalName}/WEB-INF</targetPath>
</resource>
</webResouces>
</configuration> -->
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>Spring.properties</include>
</includes>
</resource>
</resources>
</build>
<profiles>
<profile>
<id>staging</id>
<activation>
<property>
<name>environment</name>
<value>staging</value>
</property>
</activation>
<properties>
<hibernate.dialect>org.hibernate.dialect.Oracle10gDialect</hibernate.dialect>
<hibernate.show_sql>true</hibernate.show_sql>
<hibernate.url>myoracleurl</hibernate.url>
<DriverClassName>oracle.jdbc.driver.OracleDriver</DriverClassName>
</properties>
</profile>
<profile>
<id>alpha</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<hibernate.dialect>org.hibernate.dialect.Oracle10gDialect</hibernate.dialect>
<hibernate.show_sql>true</hibernate.show_sql>
<hibernate.url>myoracleurl</hibernate.url>
<DriverClassName>oracle.jdbc.driver.OracleDriver</DriverClassName>
</properties>
</profile>
</profiles>
<properties>
<!-- Generic properties -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<!-- SPRING & HIBERNATE/JPA -->
<spring.version>4.3.5.RELEASE</spring.version>
<hibernate.version>5.2.5.Final</hibernate.version>
</properties>
<dependencies>
<dependency>
<groupId>StrategicTestArchitecture</groupId>
<artifactId>Commons</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
任何人都可以擺脫一些光至於爲什麼這些文件沒有被複制到輸出目錄?
你不需要任何配置。 'mvn clean install'默認會從'src/main/java','src/main/resources'和'src/main/webapp'建立一個正確結構的WAR文件。 –
刪除配置沒有改變輸出:( src/main/webapp下的所有東西都在war和target/$ finalName的根目錄下,但不在我們需要它們的目標/類中:/ – Alex
爲什麼你想要你的webapp資源在'target/classes'? –