maven 3 - How do I add a project as a dependency of another project? -
there 2 independent projects (mywarproject
, myejbproject
). when build mywarproject
need install myejbproject
in local repository, can define in mywarproject dependency , package mywarproject successfully.
is there way handle without install myejbproject
separately , without defining parent modules.
i know can achieved through ant build, wonder whether there way handle through maven?
we can create parent project "pom" , move other 2 under parent project. however, unfortunately cannot have 2 separate projects in cvs cannot change structure. if can handle through pom file, im looking for.
assuming myejbproject not maven project own or want build maven, use system dependencies link existing jar file of project so
<project> ... <dependencies> <dependency> <groupid>yourgroup</groupid> <artifactid>myejbproject</artifactid> <version>2.0</version> <scope>system</scope> <systempath>path/to/myejbproject.jar</systempath> </dependency> </dependencies> ... </project>
that said better (and preferred way) install package repository either making maven project , building or installing way seem do.
edit: if are, however, dependent on each other, can create separate parent project (has "pom" project) declaring 2 other projects "modules". (the child projects not have declare third project parent). consequence you'd new directory new parent project, you'd quite put 2 independent projects this:
parent |- pom.xml |- myejbproject | `- pom.xml `- mywarproject `- pom.xml
the parent project "modules" section name child modules. aggregator use dependencies in child modules find out order in projects built)
<project> ... <artifactid>myparentproject</artifactid> <groupid>...</groupid> <version>...</version> <packaging>pom</packaging> ... <modules> <module>myejbmodule</module> <module>mywarmodule</module> </modules> ... </project>
that way projects can relate each other (once installed in local repository) still used independently artifacts in other projects
edit2:
finally, if projects not in related directories, might try give them relative modules:
filesystem |- mywarproject | `pom.xml |- myejbproject | `pom.xml `- parent `pom.xml
now (worked in maven 2, tried it):
<!--parent--> <project> <modules> <module>../mywarproject</module> <module>../myejbproject</module> </modules> </project>
Comments
Post a Comment