0

My entire pom.xml is below. With this pom I get this error in Eclipse "Plugin execution not covered by lifecycle configuration: org.apache.cxf:cxf-java2ws-plugin:3.1.8:java2ws (execution: process-classes, phase: process-classes)". Nevertheless, it does work properly. I mean, if I "mvn clean package install" I get the output wsdl file desired.

If I added pluginManagement, the error in Eclipse desapears but I don't get the wsdl file desired neither I get an error in my console. The two closest discussions I found about it was "Publishing wsdl java M2E plugin execution not covered" and "How to solve "Plugin execution not covered by lifecycle configuration" for Spring Data Maven Builds" but I didn't understand them. As far as I can see, the idea is to change to take advantage of

"<lifecycleMappingMetadata>...<action><execute/>".

My straight question is: why does my below pom works when I take away pluginManagement? I guess, not sure, that I am missing a basic knowledgement about the relantionship between pluginManagement and execution. The most relevant part from my question is not what is worng with Eclipse (I found few people saying to ignore it).

I have been using pluginManagement for while but I have never wondering exactly what extra features it adds to my pom. Since now it is failing with java2ws, I am really interested to understand if there is any extra configuration I should add in my pom in order to get it up and running with pluginManagement and goal>java2ws.

<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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>grp</groupId>
    <artifactId>art</artifactId>
    <packaging>war</packaging>

    <version>0.0.1-SNAPSHOT</version>
    <name>art Maven Webapp</name>
    <url>http://maven.apache.org</url>
    <properties>
        <jdk.version>1.8</jdk.version>
        <cxf.version>3.1.8</cxf.version>
        <spring.version>4.3.4.RELEASE</spring.version>
        <!-- <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> -->
    </properties>

    <dependencies>
        <!-- Spring dependencies -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <!-- Apache cxf dependencies -->
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-frontend-jaxws</artifactId>
            <version>${cxf.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-transports-http</artifactId>
            <version>${cxf.version}</version>
        </dependency>
        <!-- servlet & jsp -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.0.1</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet.jsp</groupId>
            <artifactId>javax.servlet.jsp-api</artifactId>
            <version>2.3.1</version>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>1.1.2</version>
        </dependency>
    </dependencies>
    <build>
        <finalName>art</finalName>
        <!-- <pluginManagement> -->

            <plugins>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.2</version>
                    <configuration>
                        <source>${jdk.version}</source>
                        <target>${jdk.version}</target>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>org.apache.cxf</groupId>
                    <artifactId>cxf-java2ws-plugin</artifactId>
                    <version>${cxf.version}</version>
                    <executions>
                        <execution>
                            <id>process-classes</id>
                            <phase>process-classes</phase>
                            <configuration>

                                <className>art.VmxService</className>

                                <outputFile>${project.basedir}/src/main/resources/VmxService.wsdl</outputFile>
                                <genWsdl>true</genWsdl>
                                <verbose>true</verbose>

                                <address>http://localhost:9080/art/VmxService</address>
                            </configuration>
                            <goals>
                                <goal>java2ws</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

            </plugins>
<!--        </pluginManagement> -->
    </build>
</project>
Community
  • 1
  • 1
DemeCarvO
  • 487
  • 4
  • 16
  • 28

1 Answers1

0

The pluginManagement section serves a similar purpose like the dependencyManagement section. It defines plugins and their version and configuration defaults, without actually adding them to the maven build lifecycle.

Once the plugin is added in a module it will pick up the configuration from the pluginManagement section.

Also see: Maven: What is pluginManagement?

So if a similar configuration of the same plugin is used in multiple modules you can collect them together in one place. If the plugin is only used in one module I prefer to just put it in there directly in the build. But both ways work.

Remember you also need to add the plugin to the build.plugins - simply having them in pluginManagement does nothing.

The warning in eclipse relates more to the life-cycle of your IDE. It differs a bit from the maven lifecycle and in some cases it cannot detect (or could not?) at what moment a plugin is supposed to run. Some plugins also cannot execute without a maven project. So I'm never sure what that lifecycle-mapping plugin tries to solve :/

Anyways: if you generate the classes using a maven build and this works for you (not having that done when telling eclipse to 'build' the project without maven) you're good.

I thought that information (the lifecycle mapping) is nowadays baked into the plugins directly and read by the m2eclipse plugin. I've seen such xml files in some plugins. So the lifecycle-mapping plugin might not be required anymore at all.

Community
  • 1
  • 1
wemu
  • 7,952
  • 4
  • 30
  • 59
  • Wemu, certainly you answered 100% my question. A last comment if you are Eclipse user, do you know how to set off "The warning in eclipse relates more to the life-cycle of your IDE"? – DemeCarvO Dec 06 '16 at 13:35
  • 1
    I'm sorry I'm not up to date with the eclipse evolution. I simply ignored the life-cycle-mapping warnings in the past. That might just be a validation setting somewhere? Usually every warning in Eclipse can be disabled or its priority changed. – wemu Dec 06 '16 at 14:41