You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Mark Doyle <ma...@gmail.com> on 2014/09/24 16:03:47 UTC

Best practices for kar packing an existing project that has unit tests.

Hi all,

I have a project that has a collection of unit tests that are obviously run
in the maven test phase.

I'd like to use the karaf plugin and the kar packaging type to generate a
features file and a kar archive.

However, when I build my project, my unit tests fail as the test resources
are no longer found. It makes sense that test material and code would not
end up in the kar but I'm not sure what the recommended process is for
having both. I feel like I'm missing something with the karaf plugin.

Thanks in advance.

Re: Best practices for kar packing an existing project that has unit tests.

Posted by Achim Nierbeck <bc...@googlemail.com>.
Hi Mark,

don't know about your setup, but basically I'd expect the tests to be in a
different module as the kar bundling itself.
A usual test environment for Karaf would consist of a module for
integration testing with Pax Exam and Karaf. That module should contain all
junit specifc stuff and expects a Karaf with your kar installed.
Or do you do this differently?
And if why? :)

regards, Achim






2014-09-24 16:03 GMT+02:00 Mark Doyle <ma...@gmail.com>:

> Hi all,
>
> I have a project that has a collection of unit tests that are obviously
> run in the maven test phase.
>
> I'd like to use the karaf plugin and the kar packaging type to generate a
> features file and a kar archive.
>
> However, when I build my project, my unit tests fail as the test resources
> are no longer found. It makes sense that test material and code would not
> end up in the kar but I'm not sure what the recommended process is for
> having both. I feel like I'm missing something with the karaf plugin.
>
> Thanks in advance.
>



-- 

Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
blog <http://notizblog.nierbeck.de/>

Software Architect / Project Manager / Scrum Master

Re: Best practices for kar packing an existing project that has unit tests.

Posted by MarkD <ma...@googlemail.com>.
Ah, ok, I think I see.

I've created a new module for generating the karaf features and just create
dependencies upon my proejcts. I've set the packaging type to kar which
generates the features.xml file and then creates the kar.

I then use this a dependency in another module to create a karaf-assembly.

Thanks, chaps!



--
View this message in context: http://karaf.922171.n3.nabble.com/Best-practices-for-kar-packing-an-existing-project-that-has-unit-tests-tp4035488p4035491.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: Best practices for kar packing an existing project that has unit tests.

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Mark,

A kar file is a zip file containing a repository folder, where you find 
features repositories XML and all dependencies.
So you can create it by hand (or using the maven-assembly-plugin).

On the other hand, the karaf-maven-plugin provides:
- features-generate-descriptor goal to create the features XML (for 
"complex" features XML, I would recommend to create the features XML by 
hand)
- features-create-kar goal taking a features XML and creating the kar 
file for you

In your case, you should filter the test resources, or separate the test 
in another Maven module.

Regards
JB

On 09/24/2014 04:03 PM, Mark Doyle wrote:
> Hi all,
>
> I have a project that has a collection of unit tests that are obviously
> run in the maven test phase.
>
> I'd like to use the karaf plugin and the kar packaging type to generate
> a features file and a kar archive.
>
> However, when I build my project, my unit tests fail as the test
> resources are no longer found. It makes sense that test material and
> code would not end up in the kar but I'm not sure what the recommended
> process is for having both. I feel like I'm missing something with the
> karaf plugin.
>
> Thanks in advance.

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com