Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does the WTP plugin deploy one Maven dependency as a folder, instead of a jar?

I have a very strange problem with Maven and the Eclipse WTP. I have a multi-module project, let's call it project. It consists of two modules project-base and project-web. I have the workspace resolution enabled (and it works fine with several other very similar Maven projects).

project-base is a dependency of project-web and it's normally deployed as a jar file. But for several days, it keeps being deployed as a class folder in my local Tomcat, as you can see here: Dependency deployed as folder, not as jar

Therefore, my Tomcat does not recognize any of my class files in there, because it expects them to be jars, not folder. The -tests suffix comes from the need to have the test from base in my web project. I don't think this is the problem.

project-web has three dependencies being resolved from the workspace. Two of them are deployed correctly, as jar, but the third one is not.

project-base's pom.xml is shown here:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <artifactId>project</artifactId>
        <groupId>com.company.project</groupId>
        <version>4.0.0</version>
    </parent>
    <artifactId>project-base</artifactId>
    <name>projectBase</name>
    <packaging>jar</packaging>

    <properties>
        <project.build.sourceEncoding>windows-1251</project.build.sourceEncoding>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>2.3.2</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>jar</goal>
                            <goal>test-jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-site-plugin</artifactId>
                <version>3.0</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-project-info-reports-plugin</artifactId>
                <version>2.4</version>
            </plugin>
        </plugins>
    </build>
</project>

The dependency project-base as it is defined in project-web looks like this:

<dependency>
    <groupId>com.company.project</groupId>
    <artifactId>project-base</artifactId>
    <version>${project.version}</version>
</dependency>

<dependency>
    <groupId>com.company.project</groupId>
    <artifactId>project-base</artifactId>
    <version>${project.version}</version>
    <type>test-jar</type>
    <scope>test</scope>
</dependency>

I don't have an idea why one dependency is deployed in such a strange way and I don't know how to fix this. I cleaned the projects, the tomcat, redeployed the web project, purged my whole Maven repository, checked out the whole project fresh from VCS, nothing helped.

What could cause Eclipse WTP to deploy this dependency as a folder instead of a jar file?

like image 746
guerda Avatar asked Jul 06 '12 14:07

guerda


2 Answers

I solved the problem by deleting the dependency in the "Deployment assembly" project settings page and adding it back.

like image 133
mably Avatar answered Sep 19 '22 08:09

mably


I was just having the same problem. Upgrading m2e to version 1.2 fixed it.

like image 41
abinet Avatar answered Sep 17 '22 08:09

abinet