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:
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?
I solved the problem by deleting the dependency in the "Deployment assembly" project settings page and adding it back.
I was just having the same problem. Upgrading m2e to version 1.2 fixed it.
If that folder is an exploded JAR (so it is like a JAR file, but appearing as a folder, not archived), in my case it was a server connector issue.
Although I use JBoss instead of Tomcat, this might be helpful for others struggling with this problem.
Provided you have the latest JBoss Tools installed on your Eclipse, you can double-click the server in Server view to open the settings.
On Deployment tab, you can select Zip Module Yes/No for each project. When I selected YES for my utility jar files, JBoss then deployed the dependency as a normal JAR file instead of a folder.
I ultimately solved my problem: I had problems with the properties section Deployment Assembly for the
project-base
project. I could not save it, as Eclipse mentioned, the current page does contain errors.I then looked into the settings file
.settings/org.eclipse.wst.common.component
. It was completely empty (I don't know why). I then added the following block:After this, the settings page is accessible again and the JAR is assembled correctly. Workspace resolution does work, too.