Problem: With maven, the required jar files are somewhere in a repository but not anywhere in the project directory, which makes it difficult to write a shell script to start the program. I asked on the
maven-users list how to solve this and got several useful replies:
Patrick Kimber wrote:
You can use the Maven 2 Exec plugin...
Although there is a bug which will prevent you passing parameters to
the application.
Alternatively the dependency plugin will copy your jar files to a
folder. Try running:
mvn dependency:copy-dependencies
Your dependencies will all be copied to:
targetdependency
franz see wrote:
And as for finding the artifacts that you need, you may want to use Archiva.
jiangshachina wrote:
I used the approach.
dependency-maven-plugin
may help you.
The plugin can copy all dependencies from the repository to a specific
location.
Kaare Nilsen wrote:
> Is there a simple solution, how do I set the classpath in the shell to run the
> program?
There are a least two good solutions (and most probably even more) :
1) use the exec-maven-plugin and use the java goal which will run your
app in the maven vm, and is very useful during development
2) a somewhat better solution is to use the appassembler plugin which
generates unix and windows scripts for you with all your classpaths
and more
> Or how do I make maven copy the jar files from the repository to
> somewhere I can use them?
the appassembler i mentioned above will do this for you, copying them
to your target directory for easy packaging with the assembler plugin
later
Thanks guys!
Now I'll check out what works best for me