在本地存储库中自动安装项目?

Automatically install a project in the local repository?

我试图通过不使用工作区解析来解决 Maven 错误 MDEP-187 ( https://issues.apache.org/jira/browse/MDEP-187 )。

这迫使我为我的所有依赖项执行 mvn 安装,我通过在 eclipse 中创建目标安装的启动配置来执行此操作。

问题是我必须为我的多项目工作区中的每个项目创建一个启动配置,除了安装之外我还必须手动调用每个启动配置并 运行 它。这是行不通的。

是否可以在本地仓库中自动安装一个项目? (每当我更新我的代码时)

如果您不需要在 Eclipse 中 运行 dependency:copy,您可以使用以下解决方法:

  • profile 添加到您的 pom.xml,如下所示:

    <profiles>
        <profile>
            <id>copy</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <version>2.10</version>
                        <executions>
                            [...]
                        </executions>
                    </plugin>
                </plugins> 
            <build>
        <profile>
    </profiles>
    
  • 在 Eclipse 中启用工作区解析。

那么 Eclipse 将不会使用 dependency:copy,但您可以使用 dependency:copy 命令行:mvn install -P copy

我确实采用了@khmarbaise 解决方案:

But than you need to can handle the whole thing via maven-assembly-plugin which can create archives / folders with all the dependencies. Apart from that a swing ui must be started somehow which will need some kind of shell script / batch file which you can create by using appassembler-maven-plugin...And it sounds like you need to go for a multi module project in maven..cause you might have parts like core, ui, etc. which are needed to be combined in the end.

@khmarbaise i was in the understanding that the assembly-plugin didn't support putting dependencies in a lib/ folder (just putting everything in 1 big jar), but after a little bit of trying i just go myself a zip with a runnable jar and my dependencies in a lib/ folder. Tomorrow i'm going to read a bit more about the assembly-plugin. I'm happy ;-