P
P
Prototik2012-08-04 18:16:33
Java
Prototik, 2012-08-04 18:16:33

Maven, war and scope = provided not working?

In general, there is a web project.
Assembled by maven.
In war.
I use a couple of libraries, but I need to use them with scope = provided, that is, do not include the library classes in the final war.
The problem is this: maven-war-plugin didn't care what I want there.
Still includes libraries in war.
If you switch the project to jar, everything is correct, you get a small jar.
Who knows how to convince this stubborn donkey?

I'm wildly sorry, I did mvn clean, everything is ok.
Damn, he couldn't have done it himself, could he?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
serso, 2012-08-04
@serso

You have an error somewhere. I just tried:

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
        </dependency>

and
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
            <scope>provided</scope>
        </dependency>

for
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.1.1</version>
            <configuration>
                <failOnMissingWebXml>false</failOnMissingWebXml>
            </configuration>
        </plugin>

In the first case, I received jstl-1.2.jar in the .war archive, in the second - no.
Maybe you forgot to call mvn clean?
Or your library is included in transitive dependencies (although then, of course, it should also be included in the jar)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question