Classic case...
Blinded by the very light I was looking for :-)
Thanks Peter, still few small problems updating the repository but I
should manage...
Hayes, Peter wrote:
Just a shot in the dark but did you try an "mvn clean package"? Maybe the test
resources had at some point made it into the target\classes directory...
Pete
-----Original Message-----
From: Eric Daigneault [mailto:[EMAIL PROTECTED]
Sent: Tuesday, April 10, 2007 11:32 AM
To: Maven Users List
Subject: How to NOT include test resources in jar
Hi everybody,
I'm trying to package my projects and everything works fine except that
test resources are systematically included in the jar. No matter where
I put them or what I declare in testResources they always end up in the
jar. This can me problematic as some of the test can be very extensive
as they can include test databases of very big test files. Since their
only uses is for unit and specification testing there is absolutely no
reason to include them in the final release.
The project is arranged as follows :
com.mypackage.pack.specific/
|
\-src
|--main
| \-java
| \-- My source tree
\--test
\--java
|-- My test source tree
\--resources
|--unitTest
\--SpecTest
My problem is that the source tree from src/test is not included in the
jar... actually this is fine but the content of resources is included
at the root of the jar..
The end result in the jar is the following :
specific-1.0.jar
|--META-INF
| \-- ... pom and properties
|--com.mypackage.pack
| \--My source tree compiled
|--unitTest <-- Why is this here ???
\--SpecTest <--Why is this here too ??? want them removed
here is the effective POM from my latest attempt :
<?xml version="1.0"?><project>
<parent>
<artifactId>base</artifactId>
<groupId>com.mypackage</groupId>
<version>1.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>com.mypackage.pack</groupId>
<artifactId>specific</artifactId>
<name>specific</name>
<version>1.0</version>
<url>http://maven.apache.org</url>
<inceptionYear>2007</inceptionYear>
<developers>
<developer>
<id>eric</id>
<name>myself</name>
</developer>
</developers>
<build>
<sourceDirectory>D:\workspace\com.mypackage.pack.specific\src\main\java</sourceDirectory>
<scriptSourceDirectory>src/main/scripts</scriptSourceDirectory>
<testSourceDirectory>D:\workspace\com.mypackage.pack.specific\src\test\java</testSourceDirectory>
<outputDirectory>D:\workspace\com.mypackage.pack.specific\target\classes</outputDirectory>
<testOutputDirectory>D:\workspace\com.mypackage.pack.specific\target\test-classes</testOutputDirectory>
<resources>
<resource>
<directory>D:\workspace\com.mypackage.pack.specific\src\main\config</directory>
</resource>
</resources>
<testResources>
<testResource>
<directory>/src/test/java/resources</directory>
</testResource>
</testResources>
<directory>D:\workspace\com.mypackage.pack.specific\target</directory>
<finalName>specific-1.0</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-help-plugin</artifactId>
<version>2.0.1</version>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>Maven Repository Switchboard</name>
<url>http://repo1.maven.org/maven2</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<releases>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>Maven Plugin Repository</name>
<url>http://repo1.maven.org/maven2</url>
</pluginRepository>
</pluginRepositories>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.mypackage</groupId>
<artifactId>pack</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
<reporting>
<outputDirectory>target/site</outputDirectory>
</reporting>
</project>
Thanks,
Éric
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]