[jboss-jira] [JBoss JIRA] (DROOLS-495) kie maven plugin, packaging kjar, test resources file not resolved

Matteo Mortari (JIRA) issues at jboss.org
Wed May 21 13:44:57 EDT 2014


Matteo Mortari created DROOLS-495:
-------------------------------------

             Summary: kie maven plugin, packaging kjar, test resources file not resolved
                 Key: DROOLS-495
                 URL: https://issues.jboss.org/browse/DROOLS-495
             Project: Drools
          Issue Type: Bug
      Security Level: Public (Everyone can see)
    Affects Versions: 6.1.0.Beta3
            Reporter: Matteo Mortari
            Assignee: Mark Proctor


I understand the idiomatic way for a drools Kie rule Maven project to be built, as shown in the [example|https://github.com/droolsjbpm/drools/blob/master/kie-maven-plugin-example/pom.xml], is to include in the pom:
* Kie Maven plugin
* set packaging to {{kjar}}

However, normally the file resources available under
{noformat}
src/
   test/
      resources/
         aresource.txt
{noformat}
should be available while running {{mvn test}}

However I noticed if packaging is set to {{kjar}}, this fails. It is working as expected if instead the packaging is set to the standard {{jar}}

Consider the following attached example project to replicate the issue. It contains the 'aresource.txt' file in the standard Maven layout directory {{src/test/resources}} as shown above. However the following simple test fails:
{code:title=AppTest.java|borderStyle=solid}
@Test
public void testFindTheFile() {
	URL resource = getClass().getResource("/aresource.txt");
	assertNotNull(resource);
}
{code}

Setting instead the project packaging to the standard {{jar}} instead, pass the test, and in fact it can be noticed the 'aresource.txt' file is available under {{target/test-classes}} directory.

Extract of the pom failing the test due to packaging set to {{kjar}}
{code:xml|title=pom.xml}
<project ...>
  <modelVersion>4.0.0</modelVersion>

  <groupId>com.acme</groupId>
  <artifactId>drools6test.testresources</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  
  <packaging>kjar</packaging>
  
<!-- ... -->
  
	<dependencyManagement>
		<dependencies>
			<dependency>
				<groupId>org.drools</groupId>
				<artifactId>drools-bom</artifactId>
				<type>pom</type>
				<version>6.1.0.Beta3</version>
				<scope>import</scope>
			</dependency>
		</dependencies>
	</dependencyManagement>
	
<!-- ... -->

	<build>
		<finalName>drools6test.testresources</finalName>
		<plugins>
			<plugin>
				<groupId>org.kie</groupId>
				<artifactId>kie-maven-plugin</artifactId>
				<version>6.1.0.Beta3</version>
				<extensions>true</extensions>
			</plugin>
		</plugins>
</project>
{code}

Thank you in advance for your feedback accordingly;
Ciao
Matteo



--
This message was sent by Atlassian JIRA
(v6.2.3#6260)


More information about the jboss-jira mailing list