簡體   English   中英

如何將戰爭的罐子移動(或復制)到另一個戰爭的文件夾中?

[英]How to move (or copy) a war's jar to another war's folder?

我有2個模塊的maven prj:一個JAR和一個依賴JAR的WAR。

在進行MAVEN INSTALL之后,我將包含所有jar依賴項(包括第一個模塊的JAR)的經典WEB-INF / lib文件夾放入WAR。

我需要將第一個模塊的JAR移到另一個文件夾,例如WEB-INF / resources。 如我所能?

我能夠移動廣口瓶,但僅在目標內,WAR保持不變。 我使用了以下插件:

...
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>2.9</version>
            <executions>
                <execution>
                    <id>copy-installed</id>
                    <phase>install</phase>
                    <goals>
                        <goal>copy</goal>
                    </goals>
                    <configuration>
                        <artifactItems>
                            <artifactItem>
                                <groupId>groupId</groupId>
                                <artifactId>artifactId</artifactId>
                                <version>1.0</version>
                                <type>jar</type>
                                <overWrite>false</overWrite>
                                <outputDirectory>${project.build.directory}/.../WEB-INF/services</outputDirectory>
                            </artifactItem>
                        </artifactItems>
                        <outputDirectory>${project.build.directory}/.../WEB-INF/services</outputDirectory>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>    

也許這會有所幫助:

<project.warSourceDirectory>${basedir}/src/main/webapp</project.warSourceDirectory>
...

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-dependency-plugin</artifactId>
    <version>2.9</version>
    <executions>
        <execution>
            <id>copy-installed</id>
            <phase>install</phase>
            <goals>
                <goal>copy</goal>
            </goals>
            <configuration>
                <artifactItems>
                    <artifactItem>
                        <groupId>groupId</groupId>
                        <artifactId>artifactId</artifactId>
                        <version>1.0</version>
                        <type>jar</type>
                        <overWrite>false</overWrite>
                        <outputDirectory>${project.warSourceDirectory}/WEB-INF/services</outputDirectory>
                    </artifactItem>
                </artifactItems>
            </configuration>
        </execution>
    </executions>
</plugin>

現在,我投降了。

我無法將此JAR從WEB-INF / lib移至EAR的WEB-INF / services。 我使用的解決方法是說MODULE1將其JAR復制到MODULE2的WEB-INF / services中。 因此,JAR將出現在source文件夾的WEB-INF /服務中,TARGET文件夾的WEB-INF /服務中,最后出現在EAR的WEB-INF /服務中。

我用了:

    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <version>2.5</version>
            <configuration>
                <outputDirectory>..MOSULE1/src/main/webbapp/WEB-INF/services</outputDirectory>
            </configuration>
        </plugin>
    </plugins>

進入MODULE1 pom。

我不得不放棄讓module1獨立成為module2;(

我希望我會找到一個干凈的解決方案。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM