You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Martin Gilday <ma...@imap.cc> on 2008/09/17 13:58:19 UTC

Camel Maven Plugin looking in test-classes

Hi Camel riders,

We follow what I think is a fairly standard pattern where we name our
test classes the same as the class under test with the suffix UnitTest
or IntTest.  We place this in the same package name, but under
src/test/java instead of src/main/java.  

I have a route scanner defined as so:

<camel:camelContext>
  <camel:package>example.routes</camel:package>
</camel:camelContext>

When I start up mvn camel:run I can see the following log lines:

DEBUG org.apache.camel.util.ResolverUtil  - Loading from directory:
C:\workspace\projectname\target\classes\example\routes
DEBUG org.apache.camel.util.ResolverUtil  - Loading from directory:
C:\workspace\projectname\target\test-classes\example\routes

This causes a problem as it attempts to load a class in test-classes
which has a super class of AbstractJUnit4SpringContextTests which in the
Maven POM is defined with test depdendency scope.  Therefore you get a
java.lang.NoClassDefFoundError.

Why is Camel scanning test classes for routes?  Is there a way to
prevent this other than changing the test package name?

Thanks,
Martin.

Re: Camel Maven Plugin looking in test-classes

Posted by Stephen Gargan <st...@gmail.com>.
The test-jar goal should take care of this if, like you say, they are
under /test/resources/. How you run the camel:run plugin will change
depending on how many maven modules you have and where the spring
configs live.

Your two basic options are

1) you have a single project where eveything lives, your test routes,
test spring configs live and where you're also running camel:run.

or

2)  your test routes live in a separate maven module

if its 1) then  you'll probably need to attach the camel:run goal to
the 'integration-test' phase of the maven lifecycle so that the tests
jar will be created before camel runs. Do this by adding the following
the plugin config

<execution>
       <phase>integration-test</phase>
       <goals>
         <goal>run</goal>
       </goals>
     </execution>


If 2) then there is no need to change the execution phase  you'll be
fine as thetest-routes artifact will be available at the test-compile
phase where camel:run normally executes.

Give this a try.

ste

On Thu, Dec 17, 2009 at 4:15 PM, mistrz <gr...@edmunds.com> wrote:
>
> Using this strategy would Camel load the spring config file under
> /test/resources/META-INF/spring which my test routes depend on?
>
>
>
> Stephen Gargan wrote:
> >
> > If your test routes are bundled up into an artifact you can add them as a
> > dependency to the camel plugin. The plugin needs to be configured to use
> > the
> > plugin classpath using the 'includePluginDependencies' configuration
> > value.
> >
> > The easiest way to do this is to add the test-jar goal to the project that
> > contains the test routes.
> >
> > <plugin>
> >         <groupId>org.apache.maven.plugins</groupId>
> >         <artifactId>maven-jar-plugin</artifactId>
> >         <executions>
> >           <execution>
> >             <goals>
> >               <goal>test-jar</goal>
> >             </goals>
> >           </execution>
> >         </executions>
> >       </plugin>
> >
> > This will create an artifact with the '-tests' classifier which you can
> > then
> > add to your camel plugin config as follows.
> >
> >       <plugin>
> >         <groupId>org.apache.camel</groupId>
> >         <artifactId>camel-maven-plugin</artifactId>
> >         <version>${camel.version}</version>
> >         <configuration>
> >             <includePluginDependencies>true</includePluginDependencies>
> >         </configuration>
> >         <dependencies>
> >           <dependency>
> >             <groupId>${pom.groupId}</groupId>
> >             <artifactId>my-extra-routes</artifactId>
> >             <version>${pom.version}</version>
> >             <classifier>tests</classifier>
> >           </dependency>
> >         </dependencies>
> >       </plugin>
> >
> > Give this a try, it should work well for you.
> >
> > ste
> >
> >
> > On Thu, Dec 17, 2009 at 2:42 PM, mistrz <gr...@edmunds.com> wrote:
> >
> >>
> >> I have a use case where I want to use test classes--a parameter similar
> >> to
> >> Jetty's "useTestClasspath" would be useful.
> >>
> >> I have a core library that other projects will be using and I want that
> >> core
> >> library to be run with mvn camel:run for a sample route.  The sample
> >> route
> >> is defined under test because I don't want projects including my library
> >> to
> >> contain it.
> >>
> >>
> >>
> >>
> >> --
> >> View this message in context:
> >> http://old.nabble.com/Camel-Maven-Plugin-looking-in-test-classes-tp19530527p26836330.html
> >> Sent from the Camel - Users (activemq) mailing list archive at
> >> Nabble.com.
> >>
> >>
> >
> >
>
> --
> View this message in context: http://old.nabble.com/Camel-Maven-Plugin-looking-in-test-classes-tp19530527p26837258.html
> Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.
>

Re: Camel Maven Plugin looking in test-classes

Posted by Willem Jiang <wi...@gmail.com>.
I think it will work, the camel:run plugin will try to load the 
classpath:/META-INF/spring/*.xml by default.

Willem

mistrz wrote:
> Using this strategy would Camel load the spring config file under
> /test/resources/META-INF/spring which my test routes depend on?
> 
> 
> 
> Stephen Gargan wrote:
>> If your test routes are bundled up into an artifact you can add them as a
>> dependency to the camel plugin. The plugin needs to be configured to use
>> the
>> plugin classpath using the 'includePluginDependencies' configuration
>> value.
>>
>> The easiest way to do this is to add the test-jar goal to the project that
>> contains the test routes.
>>
>> <plugin>
>>         <groupId>org.apache.maven.plugins</groupId>
>>         <artifactId>maven-jar-plugin</artifactId>
>>         <executions>
>>           <execution>
>>             <goals>
>>               <goal>test-jar</goal>
>>             </goals>
>>           </execution>
>>         </executions>
>>       </plugin>
>>
>> This will create an artifact with the '-tests' classifier which you can
>> then
>> add to your camel plugin config as follows.
>>
>>       <plugin>
>>         <groupId>org.apache.camel</groupId>
>>         <artifactId>camel-maven-plugin</artifactId>
>>         <version>${camel.version}</version>
>>         <configuration>
>>             <includePluginDependencies>true</includePluginDependencies>
>>         </configuration>
>>         <dependencies>
>>           <dependency>
>>             <groupId>${pom.groupId}</groupId>
>>             <artifactId>my-extra-routes</artifactId>
>>             <version>${pom.version}</version>
>>             <classifier>tests</classifier>
>>           </dependency>
>>         </dependencies>
>>       </plugin>
>>
>> Give this a try, it should work well for you.
>>
>> ste
>>
>>
>> On Thu, Dec 17, 2009 at 2:42 PM, mistrz <gr...@edmunds.com> wrote:
>>
>>> I have a use case where I want to use test classes--a parameter similar
>>> to
>>> Jetty's "useTestClasspath" would be useful.
>>>
>>> I have a core library that other projects will be using and I want that
>>> core
>>> library to be run with mvn camel:run for a sample route.  The sample
>>> route
>>> is defined under test because I don't want projects including my library
>>> to
>>> contain it.
>>>
>>>
>>>
>>>
>>> --
>>> View this message in context:
>>> http://old.nabble.com/Camel-Maven-Plugin-looking-in-test-classes-tp19530527p26836330.html
>>> Sent from the Camel - Users (activemq) mailing list archive at
>>> Nabble.com.
>>>
>>>
>>
> 


Re: Camel Maven Plugin looking in test-classes

Posted by mistrz <gr...@edmunds.com>.
Using this strategy would Camel load the spring config file under
/test/resources/META-INF/spring which my test routes depend on?



Stephen Gargan wrote:
> 
> If your test routes are bundled up into an artifact you can add them as a
> dependency to the camel plugin. The plugin needs to be configured to use
> the
> plugin classpath using the 'includePluginDependencies' configuration
> value.
> 
> The easiest way to do this is to add the test-jar goal to the project that
> contains the test routes.
> 
> <plugin>
>         <groupId>org.apache.maven.plugins</groupId>
>         <artifactId>maven-jar-plugin</artifactId>
>         <executions>
>           <execution>
>             <goals>
>               <goal>test-jar</goal>
>             </goals>
>           </execution>
>         </executions>
>       </plugin>
> 
> This will create an artifact with the '-tests' classifier which you can
> then
> add to your camel plugin config as follows.
> 
>       <plugin>
>         <groupId>org.apache.camel</groupId>
>         <artifactId>camel-maven-plugin</artifactId>
>         <version>${camel.version}</version>
>         <configuration>
>             <includePluginDependencies>true</includePluginDependencies>
>         </configuration>
>         <dependencies>
>           <dependency>
>             <groupId>${pom.groupId}</groupId>
>             <artifactId>my-extra-routes</artifactId>
>             <version>${pom.version}</version>
>             <classifier>tests</classifier>
>           </dependency>
>         </dependencies>
>       </plugin>
> 
> Give this a try, it should work well for you.
> 
> ste
> 
> 
> On Thu, Dec 17, 2009 at 2:42 PM, mistrz <gr...@edmunds.com> wrote:
> 
>>
>> I have a use case where I want to use test classes--a parameter similar
>> to
>> Jetty's "useTestClasspath" would be useful.
>>
>> I have a core library that other projects will be using and I want that
>> core
>> library to be run with mvn camel:run for a sample route.  The sample
>> route
>> is defined under test because I don't want projects including my library
>> to
>> contain it.
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://old.nabble.com/Camel-Maven-Plugin-looking-in-test-classes-tp19530527p26836330.html
>> Sent from the Camel - Users (activemq) mailing list archive at
>> Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://old.nabble.com/Camel-Maven-Plugin-looking-in-test-classes-tp19530527p26837258.html
Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.


Re: Camel Maven Plugin looking in test-classes

Posted by Stephen Gargan <st...@gmail.com>.
If your test routes are bundled up into an artifact you can add them as a
dependency to the camel plugin. The plugin needs to be configured to use the
plugin classpath using the 'includePluginDependencies' configuration value.

The easiest way to do this is to add the test-jar goal to the project that
contains the test routes.

<plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>test-jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

This will create an artifact with the '-tests' classifier which you can then
add to your camel plugin config as follows.

      <plugin>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-maven-plugin</artifactId>
        <version>${camel.version}</version>
        <configuration>
            <includePluginDependencies>true</includePluginDependencies>
        </configuration>
        <dependencies>
          <dependency>
            <groupId>${pom.groupId}</groupId>
            <artifactId>my-extra-routes</artifactId>
            <version>${pom.version}</version>
            <classifier>tests</classifier>
          </dependency>
        </dependencies>
      </plugin>

Give this a try, it should work well for you.

ste


On Thu, Dec 17, 2009 at 2:42 PM, mistrz <gr...@edmunds.com> wrote:

>
> I have a use case where I want to use test classes--a parameter similar to
> Jetty's "useTestClasspath" would be useful.
>
> I have a core library that other projects will be using and I want that
> core
> library to be run with mvn camel:run for a sample route.  The sample route
> is defined under test because I don't want projects including my library to
> contain it.
>
>
>
>
> --
> View this message in context:
> http://old.nabble.com/Camel-Maven-Plugin-looking-in-test-classes-tp19530527p26836330.html
> Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.
>
>

Re: Camel Maven Plugin looking in test-classes

Posted by mistrz <gr...@edmunds.com>.
I have a use case where I want to use test classes--a parameter similar to
Jetty's "useTestClasspath" would be useful. 

I have a core library that other projects will be using and I want that core
library to be run with mvn camel:run for a sample route.  The sample route
is defined under test because I don't want projects including my library to
contain it. 




-- 
View this message in context: http://old.nabble.com/Camel-Maven-Plugin-looking-in-test-classes-tp19530527p26836330.html
Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.


RE: [SPAM] Re: Camel Maven Plugin looking in test-classes

Posted by Martin Gilday <ma...@imap.cc>.
Done.

I had a look in the outstanding issues for tools and I think the
existing one you were refering to is different enough to this issue to
warrant a new one, as it affects a different mojo/goal.


----- Original message -----
From: "Claus Ibsen" <ci...@silverbullet.dk>
To: camel-user@activemq.apache.org
Date: Wed, 17 Sep 2008 14:38:43 +0200
Subject: RE: [SPAM]  Re: Camel Maven Plugin looking in test-classes

Hi Martin

Please add a comment on the new ticket pointing to this topic via nabble
http://www.nabble.com/Camel-Maven-Plugin-looking-in-test-classes-td19530527s22882.html

This is quite important to remember so when someone steps up to fix it
he can see this conversation.


Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk

-----Original Message-----
From: Martin Gilday [mailto:martin.lists@imap.cc] 
Sent: 17. september 2008 14:12
To: camel-user@activemq.apache.org
Subject: [SPAM] Re: Camel Maven Plugin looking in test-classes

I'd rather it didn't start changing the dependencies.  The Maven plugin
is very useful for getting a Camel app running as it would be in your
live environment, adjusting the dependencies would mean that is no
longer always true.  Although the Jetty plugin has a "useTestClasspath"
parameter. Is there actually a use case where you could want to define
Camel routes in src/test/java AND have them run using the Camel Maven
plugin?  I would think test routes would only be needed when you are
either running tests from your IDE or through Maven Surefire plugin.

----- Original message -----
From: "James Strachan" <ja...@gmail.com>
To: camel-user@activemq.apache.org
Date: Wed, 17 Sep 2008 13:04:36 +0100
Subject: Re: Camel Maven Plugin looking in test-classes

2008/9/17 Martin Gilday <ma...@imap.cc>:
> Hi Camel riders,
>
> We follow what I think is a fairly standard pattern where we name our
> test classes the same as the class under test with the suffix UnitTest
> or IntTest.  We place this in the same package name, but under
> src/test/java instead of src/main/java.
>
> I have a route scanner defined as so:
>
> <camel:camelContext>
>  <camel:package>example.routes</camel:package>
> </camel:camelContext>
>
> When I start up mvn camel:run I can see the following log lines:
>
> DEBUG org.apache.camel.util.ResolverUtil  - Loading from directory:
> C:\workspace\projectname\target\classes\example\routes
> DEBUG org.apache.camel.util.ResolverUtil  - Loading from directory:
> C:\workspace\projectname\target\test-classes\example\routes
>
> This causes a problem as it attempts to load a class in test-classes
> which has a super class of AbstractJUnit4SpringContextTests which in the
> Maven POM is defined with test depdendency scope.  Therefore you get a
> java.lang.NoClassDefFoundError.
>
> Why is Camel scanning test classes for routes?  Is there a way to
> prevent this other than changing the test package name?

Hmm - I guess you could just disable the logging messages so you don't
see it happening :)

Maybe we could change camel:run to also include the test dependencies?

-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com

RE: [SPAM] Re: Camel Maven Plugin looking in test-classes

Posted by Claus Ibsen <ci...@silverbullet.dk>.
Hi Martin

Please add a comment on the new ticket pointing to this topic via nabble
http://www.nabble.com/Camel-Maven-Plugin-looking-in-test-classes-td19530527s22882.html

This is quite important to remember so when someone steps up to fix it he can see this conversation.


Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk

-----Original Message-----
From: Martin Gilday [mailto:martin.lists@imap.cc] 
Sent: 17. september 2008 14:12
To: camel-user@activemq.apache.org
Subject: [SPAM] Re: Camel Maven Plugin looking in test-classes

I'd rather it didn't start changing the dependencies.  The Maven plugin
is very useful for getting a Camel app running as it would be in your
live environment, adjusting the dependencies would mean that is no
longer always true.  Although the Jetty plugin has a "useTestClasspath"
parameter. Is there actually a use case where you could want to define
Camel routes in src/test/java AND have them run using the Camel Maven
plugin?  I would think test routes would only be needed when you are
either running tests from your IDE or through Maven Surefire plugin.

----- Original message -----
From: "James Strachan" <ja...@gmail.com>
To: camel-user@activemq.apache.org
Date: Wed, 17 Sep 2008 13:04:36 +0100
Subject: Re: Camel Maven Plugin looking in test-classes

2008/9/17 Martin Gilday <ma...@imap.cc>:
> Hi Camel riders,
>
> We follow what I think is a fairly standard pattern where we name our
> test classes the same as the class under test with the suffix UnitTest
> or IntTest.  We place this in the same package name, but under
> src/test/java instead of src/main/java.
>
> I have a route scanner defined as so:
>
> <camel:camelContext>
>  <camel:package>example.routes</camel:package>
> </camel:camelContext>
>
> When I start up mvn camel:run I can see the following log lines:
>
> DEBUG org.apache.camel.util.ResolverUtil  - Loading from directory:
> C:\workspace\projectname\target\classes\example\routes
> DEBUG org.apache.camel.util.ResolverUtil  - Loading from directory:
> C:\workspace\projectname\target\test-classes\example\routes
>
> This causes a problem as it attempts to load a class in test-classes
> which has a super class of AbstractJUnit4SpringContextTests which in the
> Maven POM is defined with test depdendency scope.  Therefore you get a
> java.lang.NoClassDefFoundError.
>
> Why is Camel scanning test classes for routes?  Is there a way to
> prevent this other than changing the test package name?

Hmm - I guess you could just disable the logging messages so you don't
see it happening :)

Maybe we could change camel:run to also include the test dependencies?

-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com

Re: Camel Maven Plugin looking in test-classes

Posted by Martin Gilday <ma...@imap.cc>.
I'd rather it didn't start changing the dependencies.  The Maven plugin
is very useful for getting a Camel app running as it would be in your
live environment, adjusting the dependencies would mean that is no
longer always true.  Although the Jetty plugin has a "useTestClasspath"
parameter. Is there actually a use case where you could want to define
Camel routes in src/test/java AND have them run using the Camel Maven
plugin?  I would think test routes would only be needed when you are
either running tests from your IDE or through Maven Surefire plugin.

----- Original message -----
From: "James Strachan" <ja...@gmail.com>
To: camel-user@activemq.apache.org
Date: Wed, 17 Sep 2008 13:04:36 +0100
Subject: Re: Camel Maven Plugin looking in test-classes

2008/9/17 Martin Gilday <ma...@imap.cc>:
> Hi Camel riders,
>
> We follow what I think is a fairly standard pattern where we name our
> test classes the same as the class under test with the suffix UnitTest
> or IntTest.  We place this in the same package name, but under
> src/test/java instead of src/main/java.
>
> I have a route scanner defined as so:
>
> <camel:camelContext>
>  <camel:package>example.routes</camel:package>
> </camel:camelContext>
>
> When I start up mvn camel:run I can see the following log lines:
>
> DEBUG org.apache.camel.util.ResolverUtil  - Loading from directory:
> C:\workspace\projectname\target\classes\example\routes
> DEBUG org.apache.camel.util.ResolverUtil  - Loading from directory:
> C:\workspace\projectname\target\test-classes\example\routes
>
> This causes a problem as it attempts to load a class in test-classes
> which has a super class of AbstractJUnit4SpringContextTests which in the
> Maven POM is defined with test depdendency scope.  Therefore you get a
> java.lang.NoClassDefFoundError.
>
> Why is Camel scanning test classes for routes?  Is there a way to
> prevent this other than changing the test package name?

Hmm - I guess you could just disable the logging messages so you don't
see it happening :)

Maybe we could change camel:run to also include the test dependencies?

-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com

Re: [SPAM] Re: [SPAM] Re: Camel Maven Plugin looking in test-classes

Posted by James Strachan <ja...@gmail.com>.
2008/9/18 Claus Ibsen <ci...@silverbullet.dk>:
> Hi
>
> Ah yeah that's the dangerous when having a mail client that is capable of sending emails before 3 cups of coffee.

Yeah :)

Shame it doesn't keep 'em in a drafts folder until your caffeine
levels are high enough...


> I have refined the camel:run plugin to skip test-classes and any test scoped maven dependencies.

Great!

-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com

RE: [SPAM] Re: [SPAM] Re: Camel Maven Plugin looking in test-classes

Posted by Claus Ibsen <ci...@silverbullet.dk>.
Hi

Ah yeah that's the dangerous when having a mail client that is capable of sending emails before 3 cups of coffee.

I have refined the camel:run plugin to skip test-classes and any test scoped maven dependencies.


Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk

-----Original Message-----
From: James Strachan [mailto:james.strachan@gmail.com] 
Sent: 18. september 2008 11:30
To: camel-user@activemq.apache.org
Subject: [SPAM] Re: [SPAM] Re: Camel Maven Plugin looking in test-classes

2008/9/17 Claus Ibsen <ci...@silverbullet.dk>:
> Hi
>
> I actually think camel:run should NOT pickup anything from src/test (test-classes)

Agreed. I'd not had that much coffee when I posted my previous mail :)

So I think we just need to fix the camel:run plugin to not use the
test classpath right?

-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com

Re: [SPAM] Re: Camel Maven Plugin looking in test-classes

Posted by James Strachan <ja...@gmail.com>.
2008/9/17 Claus Ibsen <ci...@silverbullet.dk>:
> Hi
>
> I actually think camel:run should NOT pickup anything from src/test (test-classes)

Agreed. I'd not had that much coffee when I posted my previous mail :)

So I think we just need to fix the camel:run plugin to not use the
test classpath right?

-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com

RE: [SPAM] Re: Camel Maven Plugin looking in test-classes

Posted by Claus Ibsen <ci...@silverbullet.dk>.
Hi

I actually think camel:run should NOT pickup anything from src/test (test-classes)

You use src/test for unit testing with mvn test.

I think there is a ticket in JIRA about something with classpath setting on the plugin. Please check before creating a ticket.


Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk

-----Original Message-----
From: James Strachan [mailto:james.strachan@gmail.com] 
Sent: 17. september 2008 14:05
To: camel-user@activemq.apache.org
Subject: [SPAM] Re: Camel Maven Plugin looking in test-classes

2008/9/17 Martin Gilday <ma...@imap.cc>:
> Hi Camel riders,
>
> We follow what I think is a fairly standard pattern where we name our
> test classes the same as the class under test with the suffix UnitTest
> or IntTest.  We place this in the same package name, but under
> src/test/java instead of src/main/java.
>
> I have a route scanner defined as so:
>
> <camel:camelContext>
>  <camel:package>example.routes</camel:package>
> </camel:camelContext>
>
> When I start up mvn camel:run I can see the following log lines:
>
> DEBUG org.apache.camel.util.ResolverUtil  - Loading from directory:
> C:\workspace\projectname\target\classes\example\routes
> DEBUG org.apache.camel.util.ResolverUtil  - Loading from directory:
> C:\workspace\projectname\target\test-classes\example\routes
>
> This causes a problem as it attempts to load a class in test-classes
> which has a super class of AbstractJUnit4SpringContextTests which in the
> Maven POM is defined with test depdendency scope.  Therefore you get a
> java.lang.NoClassDefFoundError.
>
> Why is Camel scanning test classes for routes?  Is there a way to
> prevent this other than changing the test package name?

Hmm - I guess you could just disable the logging messages so you don't
see it happening :)

Maybe we could change camel:run to also include the test dependencies?

-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com

Re: Camel Maven Plugin looking in test-classes

Posted by James Strachan <ja...@gmail.com>.
2008/9/17 Martin Gilday <ma...@imap.cc>:
> Hi Camel riders,
>
> We follow what I think is a fairly standard pattern where we name our
> test classes the same as the class under test with the suffix UnitTest
> or IntTest.  We place this in the same package name, but under
> src/test/java instead of src/main/java.
>
> I have a route scanner defined as so:
>
> <camel:camelContext>
>  <camel:package>example.routes</camel:package>
> </camel:camelContext>
>
> When I start up mvn camel:run I can see the following log lines:
>
> DEBUG org.apache.camel.util.ResolverUtil  - Loading from directory:
> C:\workspace\projectname\target\classes\example\routes
> DEBUG org.apache.camel.util.ResolverUtil  - Loading from directory:
> C:\workspace\projectname\target\test-classes\example\routes
>
> This causes a problem as it attempts to load a class in test-classes
> which has a super class of AbstractJUnit4SpringContextTests which in the
> Maven POM is defined with test depdendency scope.  Therefore you get a
> java.lang.NoClassDefFoundError.
>
> Why is Camel scanning test classes for routes?  Is there a way to
> prevent this other than changing the test package name?

Hmm - I guess you could just disable the logging messages so you don't
see it happening :)

Maybe we could change camel:run to also include the test dependencies?

-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com