java - How to copy dependencies of a multi module project? -
i have project depends on different project-module in workspace. i'm trying copy dependencies (including module) lib
folder creating executable jar has no packaged jars inside itself.
but maven-dependency-plugin
keeps complaining not copy module classes target folder of project. might wrong?
my.groupt my-module 1.0
<plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-dependency-plugin</artifactid> <executions> <execution> <id>copy-dependencies</id> <phase>package</phase> <goals> <goal>copy-dependencies</goal> </goals> <configuration> <outputdirectory>${project.build.directory}/lib</outputdirectory> </configuration> </execution> </executions> </plugin>
result:
failed execute goal org.apache.maven.plugins:maven-dependency-plugin:2.1:copy-dependencies (copy-dependencies) on project my-project: error copying artifact c:\workspace\my-module\target\classes c:\workspace\my-project\target\lib\classes: (access denied)
the reason failure workspace resolution in eclipse. eclipse m2e injects artifact resolution of maven.
so when my-project tries dependencies, artifact resolver returns not jar file (which not yet exist), classes folder of dependent project.
if try build project using "run -> maven install", should work.
so scenario cannot comfortably resolve in workspace. either turn of workspace resolution my-project, disable dependency plugin inside eclipse (lifecycle bindings) or use different plugin assembly copy depdencies (which cleaner, btw.). note however, latter work if maven called manually.
Comments
Post a Comment