How to create effective pom.xml in Maven (merge parent pom with modules)


Discount: https://www.udemy.com/spring-framework-4-course-and-core-spring-certification/?couponCode=spring32coupon

If you would like to create an effective pom.xml (merged pom.xml) file based on parent pom.xml and modules;
Use the following command in order to display and save it as a file;

inside module project type

mvn help:effective-pom -Doutput=mergedpom.xml

Advertisements

Plugin execution not covered by lifecycle configuration: org.apache.cxf:cxf-codegen-plugin:2.1.2:wsdl2java (execution: generate-sources, phase: generate-sources)


In order to solve this, <plugins> should be defined under <pluginManagement> tag

Discount: https://www.udemy.com/spring-framework-4-course-and-core-spring-certification/?
couponCode=spring32coupon

<pluginManagement>
<plugins>
<!-- Generate Java classes from WSDL during build -->
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>2.1.2</version>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<sourceRoot>${basedir}/src/main/java</sourceRoot>
<wsdlOptions>
<wsdlOption>
<wsdl>${basedir}/src/main/java/wsdlfile.wsdl</wsdl>
<extraargs>
<extraarg>-client</extraarg>
</extraargs>
</wsdlOption>
</wsdlOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Add generated sources - avoids having to copy generated sources to build location -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${basedir}/target/generated/src/main/java</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<!-- Build the JAR with dependencies -->
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>

maven Not authorized , ReasonPhrase:Unauthorized


[ERROR] Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.5: Could not transfer artifact org.apache.maven.plugins:maven-clean-plugin:pom:2.5 from/to nexus (http://repository/nexus/content/groups/public/): Not authorized , ReasonPhrase:Unauthorized. -> [Help 1]
[ERROR]

in settings.xml file under C:\Users\username\.m2 you should set the correct password

<servers>
<server>
<id>nexus</id>
<username>test@testsystem</username>
<password><strong>testpass</strong></password>
</server>
</servers>

Description Resource Path Location Type Cannot change version of project facet Dynamic Web Module to 2.5 Maven Java EE Configuration Problem


Exception

Description Resource Path Location Type
Cannot change version of project facet Dynamic Web Module to 2.5. jsf line 1 Maven Java EE Configuration Problem

Solution is editing web.xml

from

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
<display-name>jsf</display-name>
<servlet>

to

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" version="3.1">

and after maven update project

Maven default compiler change in Eclipse for projects


In order to prevent compiler JDK change with Maven update just add the following
in project’s pom.xml file

Default complier compliance level for Maven is 1.5

http://maven.apache.org/plugins/maven-compiler-plugin/

<!-- Maven compiler setting for project -->
	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<configuration>
					<source>1.8</source>
					<target>1.8</target>
				</configuration>
			</plugin>
		</plugins>
	</build>
		

maven-compiler