Tag Archives: maven

Java

Unable to read jar manifest from pom

Few days ago I was trying to use Spring Boot to implement some small project and I encounter strange problem. When running command

mvn eclipse:eclipse

I was getting this error:

[INFO] Unable to read jar manifest from C:\Users\Maciek\.m2\repository\org\springframework\boot\spring-boot-dependencies\1.1.1.RELEASE\spring-boot-dependencies-1.1.1.RELEASE.pom

My pom.xml was like this:

<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">
	...
	<dependencies>
		<dependency>
			<!-- Import dependency management from Spring Boot -->
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-dependencies</artifactId>
			<version>1.1.1.RELEASE</version>
			<type>pom</type>
			<scope>import</scope>
		</dependency>
	</dependencies>

</project>

I was a bit surprised, but after some googling I found out that it was my stupid mistake with copy/paste. On the Spring Boot Reference Guide it was:

<dependencyManagement>
     <dependencies>
        <dependency>
            <!-- Import dependency management from Spring Boot -->
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-dependencies</artifactId>
            <version>1.1.2.BUILD-SNAPSHOT</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

Skipping dependencyManagement was root cause of error mentioned at the beginning.

Be aware of copy/paste failures!

Java

Adding WTP Facet to project via maven

Sometimes when I add new project to my workspace I want to make it available for quick deploy to application container (in my case Tomcat). To do this I have to add WTP project facets. It can be easily done by using Maven plugins.

Check this example from pom.xml:

<profiles>
	<profile>
		<id>war</id>
		<activation>
			<activeByDefault>true</activeByDefault>
		</activation>
		<properties>
			<packaging-type>war</packaging-type>
		</properties>
		<build>
			<finalName>projectName</finalName>
			<plugins>
				<plugin>
					<artifactId>maven-eclipse-plugin</artifactId>
					<configuration>
						<wtpversion>2.0</wtpversion>
					</configuration>
				</plugin>
				<plugin>
					<artifactId>maven-compiler-plugin</artifactId>
					<configuration>
						<source>1.6</source>
						<target>1.6</target>
					</configuration>
				</plugin>
			</plugins>
			<resources>
				<resource>
					<directory>src/main/resources</directory>
				</resource>
			</resources>
			<testResources>
				<testResource>
					<directory>src/test/resources</directory>
				</testResource>
			</testResources>
		</build>
	</profile>
</profiles>

I added here maven-compiler-plugin because without this you can get following error message:

Dynamic Web Module 2.5 requires Java 1.5 or newer.