How to install dependency in maven not in WEB-INF / lib

Is there a way to install the war dependency not in WEB-INF / lib, but in a user folder?

I am using Maven 2

Hi, I need only one artifact from the list of war dependencies to be placed not in WEB-INF / lib, but in WEB-INF / bundles / and other dependencies should be in WEB-INF / lib

THX

thanks to everyone, I can not update Maven 2.1, so I did it through the maven-antrun plugin)

+3
source share
3 answers

I think you need to make a dependency providedand copy it using mvn copy-dependencies. Here is an example that does this with apache commons / lang:

<dependencies>
    <dependency>
        <groupId>commons-lang</groupId>
        <artifactId>commons-lang</artifactId>
        <version>2.5</version>
        <scope>provided</scope>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>2.1</version>
            <executions>
                <execution>
                    <id>copydep</id>
                    <phase>prepare-package</phase>
                    <goals>
                        <goal>copy-dependencies</goal>
                    </goals>
                    <inherited>false</inherited>
                    <configuration>
                        <includeArtifactIds>commons-lang</includeArtifactIds>
                        <outputDirectory>$project.build.directory/${project.build.finalName}/web-inf/bundles</outputDirectory>
                    </configuration>
                </execution>
            </executions>
            <configuration>
            </configuration>
        </plugin>
    </plugins>
</build>

( $project.build.directory/${project.build.finalName}- the working folder used to build the war)

+4

Maven war plugin . , , , , .

+1

? , WEB-INF/lib . *.jar , , (, Tomcat).

!

Maven WAR Plugin, WEB-INF/lib.

, , WAR, assembly.

0
source

Source: https://habr.com/ru/post/1768957/


All Articles