上看到的

对于资源文件混杂在java的package文件中的情况, build需要这样配置:
<build>
 <resources>
  <resource>
   <directory>../../src</directory>
   <includes>
     <include>org/springframework/core/**</include>
     <include>org/springframework/util/**</include>
   </includes>
   <excludes>
     <exclude>**/*.java</exclude>
   </excludes>
  </resource>
 </resources>
 <plugins>
  <plugin>
   <groupId>org.apache.maven.plugins</groupId>
   <artifactId>maven-compiler-plugin</artifactId>
   <configuration>
    <includes>
     <include>org/springframework/core/**</include>
     <include>org/springframework/util/**</include>
    </includes>
   </configuration>
  </plugin>
 </plugins>
</build>


将test/java, test/resources也进行打包并其他的测试类依赖的写法:
<plugin>
 <groupId>org.apache.maven.plugins</groupId>
 <artifactId>maven-jar-plugin</artifactId>
 <executions>
  <execution>
   <goals>
    <goal>test-jar</goal>
   </goals>
  </execution>
 </executions>
</plugin>

在需要依赖该test jar包的地方, 需要这样配置依赖:
<dependency>
 <groupId>${project.groupId}</groupId>
 <artifactId>spring-beans</artifactId>
 <version>${project.version}</version>
 <type>test-jar</type>
 <scope>test</scope>
</dependency>

你可能感兴趣的:(java,apache,spring,maven,xml)