On Sat, May 9, 2009 at 3:36 PM, Jeffrey N Hagelberg <[email protected]>wrote:
> There's still the question of getting directories on the classpath. The > directory we need is created during the pre-integration-test phase, so I > don't think that adding it as a test resource would work, since the resource > copying would happen before the directory is created. Any ideas about that? > For integration testing with surefire? Use additionalClasspathElements parameter ( http://maven.apache.org/plugins/maven-surefire-plugin/test-mojo.html#additionalClasspathElements ) Kalle Kalle Korhonen ---05/09/2009 04:16:34 AM---On Fri, May 8, 2009 at 6:56 PM, > Jeffrey N Hagelberg <[email protected]>wrote: > > > From: > Kalle Korhonen <[email protected]> > To: > Maven Users List <[email protected]> > Date: > 05/09/2009 04:16 AM > Subject: > Re: Dynamically Modifying the Classpath > ------------------------------ > > > > On Fri, May 8, 2009 at 6:56 PM, Jeffrey N Hagelberg > <[email protected]>wrote: > > > We are trying to find a way to add some jars that are generated during > the > > pre-integration-test phase to the class path when the integration tests > > run. There is also a folder with configuration files that is created at > > the same time that we also need to add to the class path. The jar and > > directory are both built programatically by another plugin, and maven > does > > not know anything about them. Does anyone know a way to do this? > > > Instead of making things more complicated, why wouldn't you just let Maven > know about these secondary artifacts with the help of build-helper plugin ( > > http://mojo.codehaus.org/build-helper-maven-plugin/attach-artifact-mojo.html > > )? > > Kalle > > > > > I have an idea about how to do this, but it is rather convoluted. My idea > > is to create a plugin that basically calls "mvn install:install-file" on > > each jar to put it in the local maven repository and then programatically > > add the jars as a dependencies of the project by adding artifacts for > them > > to the list returned by project.getDependencies(). My plan is to make > the > > plugin invoke the install:install-file plugin by doing something similar > to > > what the maven invoker plugin does. I don't think we can do this by > using > > install:install-file plugin directly because we don't know ahead of time > > what the exact set of jars will be. We want to add jars in a certain > > directory whose name matches a certain pattern. There's also the fact > that > > it would have to happen during the pre-integration-test phase, and as far > > as I know the execution order is undefined for goals executing in > different > > execution groups within the same phase. That is, I don't think you can't > > tell whether the executions for plugin1 or plugin2 will happen first if > > they are both in the same phase. We can't have this run before the jars > > are generated! I'd love to find out I'm wrong about this, though. > > > > As for adding the directory to the classpath, I am somewhat at a loss. > If > > the folder was created earler, I think we could add it as a test > resource. > > However, I think that the copying happens before the pre-integration-test > > phase. Right now, the only thing I can think of is to manually copy the > > contents of the folder into the test-classes directory where the compiled > > classes are. Does anyone have any other ideas? > > > > Does anyone know to do these things or if what I suggested above will > work? > > > > We're using maven 2.1.0. > > > > Thanks in advance for any help you can provide. > > > > -Jeff > > > > Jeffrey Hagelberg, Software Engineer > > XMeta Development > > IBM Software Group > > Phone: 978-899-2055 T/L:276-2055) > > Email:[email protected] <email%[email protected]> < > email%[email protected] <email%[email protected]>> > > >
