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 <[email protected]> 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 <[email protected]> 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.
>

Reply via email to