Difference between revisions of "MNG-6189"

From BITPlan Wiki
Jump to navigation Jump to search
 
(22 intermediate revisions by the same user not shown)
Line 15: Line 15:
  
 
= What to do? =
 
= What to do? =
You get this error if your configuration looks like this:
+
You get this error if your maven pom.xml configuration looks like this:
<source lang='xml' highlight="5-8, 10-15">
+
=== original pom.xml ===
<plugin>
+
<source lang='xml' highlight="9-11,21-22">
  <groupId>org.apache.maven.plugins</groupId>
+
<project>
  <artifactId>maven-site-plugin</artifactId>
+
  <build>
  <version>3.0</version>
+
    <plugins>
   <configuration>
+
      ...
    <!-- configuration of reports to be included in site -->
+
      <plugin>
     <reportPlugins>
+
        <groupId>org.apache.maven.plugins</groupId>
 +
        <artifactId>maven-site-plugin</artifactId>
 +
        <version>3.0</version>
 +
        <configuration>
 +
          <!-- configuration of reports to be included in site -->
 +
          <reportPlugins>
 +
            <plugin>
 +
            <!-- report plugin 1 -->
 +
            ...
 +
            </plugin>
 +
            <plugin>
 +
            <!-- report plugin 2 -->
 +
            ...
 +
            </plugin>
 +
            ...
 +
          <reportPlugins>
 +
        </configuration>
 +
      </plugin>
 +
    <plugins>
 +
  </build>
 +
</project>
 +
</source>
 +
 
 +
=== upgrade org.apache.maven.plugins version ===
 +
You first might want to upgrade your plugin version. You can find the current version at
 +
[https://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.apache.maven.plugins%22%20AND%20a%3A%22maven-site-plugin%22 search.maven.org]
 +
 
 +
<source lang='xml' highlight="8">
 +
<project>
 +
   <build>
 +
    <plugins>
 +
      ...
 +
      <plugin>
 +
        <groupId>org.apache.maven.plugins</groupId>
 +
        <artifactId>maven-site-plugin</artifactId>
 +
        <version>3.6</version>
 +
        <configuration>
 +
          <!-- configuration of reports to be included in site -->
 +
          <reportPlugins>
 +
            <plugin>
 +
            <!-- report plugin 1 -->
 +
            ...
 +
            </plugin>
 +
            <plugin>
 +
            <!-- report plugin 1 -->
 +
            ...
 +
            </plugin>
 +
          <reportPlugins>
 +
        </configuration>
 +
      </plugin>
 +
    <plugins>
 +
  </build>
 +
</project>
 +
</source>
 +
=== add a reporting node ===
 +
Then you might want to create a new node '''<reporting></reporting>''' (it it does not exist yet) directly unter the '''<project><project>''' node:
 +
<source lang='xml' highlight="2-3">
 +
<project>
 +
  <reporting>
 +
  </reporting>
 +
</project>
 +
</source>
 +
=== cut & paste the list of report plugins ===
 +
Now add a  '''<plugins></plugins>''' node to the reporting node cut&paste the list of report plugins from the configuration above into it like this:
 +
<source lang='xml' highlight="3-13">
 +
<project>
 +
  <reporting>
 +
     <plugins>
 
       <plugin>
 
       <plugin>
 +
        <!-- report plugin 1 -->
 +
        ...
 +
        </plugin>
 +
        <plugin>
 +
        <!-- report plugin 2 -->
 +
        ...
 +
        </plugin>
 +
        ...
 +
    <plugins>
 +
  </reporting>
 +
</project>
 +
</source>
 +
 +
=== remove configuration node if empty ===
 +
In the plugins list in the build part only:
 +
<source lang='xml' highlight="5-8">
 +
<project>
 +
  <build>
 +
    <plugins>
 
       ...
 
       ...
 +
      <plugin>
 +
        <groupId>org.apache.maven.plugins</groupId>
 +
        <artifactId>maven-site-plugin</artifactId>
 +
        <version>3.0</version>
 
       </plugin>
 
       </plugin>
    <plugin>
+
    <plugins>
 +
  </build>
 +
</project>
 +
</source>
 +
=== keep configuration node if non empty ===
 +
is needed or if you have any non report configurations:
 +
<source lang='xml' highlight="5-11">
 +
<project>
 +
  <build>
 +
    <plugins>
 
       ...
 
       ...
 +
      <plugin>
 +
        <groupId>org.apache.maven.plugins</groupId>
 +
        <artifactId>maven-site-plugin</artifactId>
 +
        <version>3.6</version>
 +
        <configuration>
 +
        ...
 +
        </configuration>
 
       </plugin>
 
       </plugin>
    <reportPlugins>
+
    <plugins>
   </configuration>
+
   </build>
</plugin>
+
</project>
 +
</source>
 +
== Check result ==
 +
run
 +
<source lang='bash'>
 +
mvn site
 
</source>
 
</source>
 +
to check that the error went away and the site plugin is working as expected.
 +
 +
= Example =
 +
See https://github.com/BITPlan/com.bitplan.antlr/blob/master/pom.xml for a complete pom.xml example

Latest revision as of 06:31, 15 October 2017

As discussed in:

https://stackoverflow.com/questions/46742407/some-problems-were-encountered-while-building-the-effective-model-for when you see the warning:

[WARNING] 
[WARNING] Some problems were encountered while building the effective model for com.bitplan.antlr:com.bitplan.antlr:jar:0.0.1
[WARNING] Reporting configuration should be done in <reporting> section, not in maven-site-plugin <configuration> as reportPlugins parameter. @ line 213, column 20
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 

You have run into an issue that is explained in:

What to do?

You get this error if your maven pom.xml configuration looks like this:

original pom.xml

<project>
  <build>
    <plugins>
      ...
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-site-plugin</artifactId>
        <version>3.0</version>
        <configuration>
          <!-- configuration of reports to be included in site -->
          <reportPlugins>
            <plugin>
            <!-- report plugin 1 -->
            ...
            </plugin>
            <plugin>
            <!-- report plugin 2 -->
            ...
            </plugin>
            ...
          <reportPlugins>
        </configuration>
      </plugin>
    <plugins>
  </build>
</project>

upgrade org.apache.maven.plugins version

You first might want to upgrade your plugin version. You can find the current version at search.maven.org

<project>
  <build>
    <plugins>
      ...
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-site-plugin</artifactId>
        <version>3.6</version>
        <configuration>
          <!-- configuration of reports to be included in site -->
          <reportPlugins>
            <plugin>
            <!-- report plugin 1 -->
            ...
            </plugin>
            <plugin>
            <!-- report plugin 1 -->
            ...
            </plugin>
          <reportPlugins>
        </configuration>
      </plugin>
    <plugins>
  </build>
</project>

add a reporting node

Then you might want to create a new node <reporting></reporting> (it it does not exist yet) directly unter the <project><project> node:

<project>
  <reporting>
  </reporting>
</project>

cut & paste the list of report plugins

Now add a <plugins></plugins> node to the reporting node cut&paste the list of report plugins from the configuration above into it like this:

<project>
  <reporting>
    <plugins>
      <plugin>
        <!-- report plugin 1 -->
        ...
        </plugin>
        <plugin>
        <!-- report plugin 2 -->
        ...
        </plugin>
        ...
    <plugins>
  </reporting>
</project>

remove configuration node if empty

In the plugins list in the build part only:

<project>
  <build>
    <plugins>
      ...
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-site-plugin</artifactId>
        <version>3.0</version>
      </plugin>
    <plugins>
  </build>
</project>

keep configuration node if non empty

is needed or if you have any non report configurations:

<project>
  <build>
    <plugins>
      ...
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-site-plugin</artifactId>
        <version>3.6</version>
        <configuration>
        ...
        </configuration>
      </plugin>
    <plugins>
  </build>
</project>

Check result

run

mvn site

to check that the error went away and the site plugin is working as expected.

Example

See https://github.com/BITPlan/com.bitplan.antlr/blob/master/pom.xml for a complete pom.xml example