如何在mutimodule项目的额外文件夹中创建具有依赖项的runnable jar?

我有一个在不同项目之间共享的公共库.由于库不断扩展(至少目前为止),它应该在构建期间从eclipse工作区中获取.

我正在尝试使用maven-dependency-plugin来复制runnable jar旁边的/ lib文件夹中的所有依赖项.但它不起作用:

<dependencies>
    <!-- A jar that is opened as project in workspace, not installed into maven repo, and not a submodule. It should just be picked up and added as jar during package. -->
    <dependency>
        <groupId>my.domain</groupId>
        <artifactId>project-commons</artifactId>
    </dependency>
</dependencies>



        <plugin>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>2.8</version>
            <executions>
                <execution>
                    <id>copy-dependencies</id>
                    <phase>package</phase>
                    <goals>
                        <goal>copy-dependencies</goal>
                    </goals>
                    <configuration>
                        <outputDirectory>${project.build.directory}/lib/</outputDirectory>
                        <overWriteReleases>true</overWriteReleases>
                    </configuration>
                </execution>
            </executions>
        </plugin>

[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-dependency-plugin:2.8:copy-dependencies
(copy-dependencies) on project mydomain: Artifact has not been
packaged yet. When used on reactor artifact, copy should be executed
after packaging: see MDEP-187. -> [Help 1]

当maven尝试复制工作区中打开的公共项目时,错误就会出现.我错过了什么吗?

最佳答案
我今天遇到了这个问题,下载了最新版本的CTAKES(3.2),它集成了YTEX,它将在命令行上构建而不是在Eclipse中构建.该错误是插件(https://jira.codehaus.org/browse/MDEP-187)显然已知问题的结果.

我最终通过改变从包到prepare-package的阶段来修复它(我认为这将解决你的问题).



制备包

试试看,看看它是否适合你.

转载注明原文:如何在mutimodule项目的额外文件夹中创建具有依赖项的runnable jar? - 代码日志