Hi,

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?

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]

Reply via email to