Wrong charset encoding using openshift - spring

I'm trying to deploy my web app with service openshift. I set charset encoding on very jsp like that: <%# page contentType="text/html;charset=UTF-8" language="java"%>
in controllers i have: produces = "text/html;charset=UTF-8"
and my pom.xml:
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<build>
<finalName>TrunkSchedule</finalName>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>${project.build.sourceEncoding}</encoding>
<compilerArgument>-Xlint:all</compilerArgument>
<showWarnings>true</showWarnings>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<encoding>${project.build.sourceEncoding}</encoding>
<warSourceDirectory>${basedir}/src/main/webapp</warSourceDirectory>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<!--some dependencies-->
</dependencies>
<profiles>
<profile>
<id>openshift</id>
<build>
<finalName>TrunkSchedule</finalName>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<encoding>${project.build.sourceEncoding}</encoding>
<outputDirectory>deployments</outputDirectory>
<warName>ROOT</warName>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
locally everything works fine, but when deploying the encoding is broken.
may be the problem in openshift?

Related

Javadoc Plugin Module Error with Site target

I'm trying to use the site target for maven to generate javadoc, but I'm getting inconsistent results. I've created a stripped down sample project to test with, and when I execute the site target along with a build target (e.g., mvn package site, or mvn compile site) it works fine. But if I execute with just the site target (i.e., mvn site) I get the error:
Exit code: 1 - error: module not found: foo.bar
I've checked the generated options files, and when a build target is included the --module-path argument includes my target/classes path, but with just the site target that path isn't included.
Does anyone know how the javadoc plugin configures those arguments and how I can get it to work both ways?
Here's my test pom.xml file:
<modelVersion>4.0.0</modelVersion>
<groupId>foo.bar</groupId>
<artifactId>MyProgram</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>
<name>MyProgram</name>
<description>
This is a sample program.
</description>
<inceptionYear>2020</inceptionYear>
<properties>
<java.source>11</java.source>
<java.target>11</java.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<clean.plugin.version>3.1.0</clean.plugin.version>
<compiler.plugin.version>3.8.0</compiler.plugin.version>
<dependency.plugin.version>3.1.2</dependency.plugin.version>
<install.plugin.version>3.0.0-M1</install.plugin.version>
<jar.plugin.version>3.2.0</jar.plugin.version>
<javadoc.plugin.version>3.2.0</javadoc.plugin.version>
<resources.plugin.version>3.1.0</resources.plugin.version>
<surefire.plugin.version>3.0.0-M3</surefire.plugin.version>
<versions.plugin.version>2.7</versions.plugin.version>
<jakarta.version>2.3.2</jakarta.version>
<project.site.root.path>${CATALINA_HOME}/webapps/projects</project.site.root.path>
</properties>
<distributionManagement>
<site>
<id>foo.bar</id>
<url>file:${project.site.root.path}/${project.artifactId}</url>
</site>
</distributionManagement>
<dependencies>
<!-- https://mvnrepository.com/artifact/jakarta.xml.bind/jakarta.xml.bind-api -->
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>${jakarta.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-engine -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.7.0-M1</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.junit.platform/junit-platform-commons -->
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-commons</artifactId>
<version>1.7.0-M1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-dependency-plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>${dependency.plugin.version}</version>
</plugin>
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-resources-plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>${resources.plugin.version}</version>
</plugin>
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-site-plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.9.0</version>
<configuration>
<locales>en</locales>
<generateSiteMap>true</generateSiteMap>
</configuration>
</plugin>
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-javadoc-plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${javadoc.plugin.version}</version>
<configuration>
<source>${java.source}</source>
<show>protected</show>
<nohelp>true</nohelp>
<detectLinks>false</detectLinks>
<detectOfflineLinks>false</detectOfflineLinks>
<detectJavaApiLink>true</detectJavaApiLink>
<failOnWarnings>true</failOnWarnings>
<additionalparam>${javadoc.opts}</additionalparam>
<sourcepath>${project.basedir}/src/main/java</sourcepath>
<subpackages>${javadoc.package}</subpackages>
<additionalJOption>-Xdoclint:all</additionalJOption>
<links>
<link>https://javadoc.io/doc/jakarta.xml.bind/jakarta.xml.bind-api/${jakarta.version}/</link>
</links>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-clean-plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>${clean.plugin.version}</version>
</plugin>
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-jar-plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>${jar.plugin.version}</version>
</plugin>
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-install-plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>${install.plugin.version}</version>
</plugin>
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-surefire-plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire.plugin.version}</version>
</plugin>
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-checkstyle-plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<configLocation>google_checks.xml</configLocation>
<encoding>${project.build.sourceEncoding}</encoding>
<consoleOutput>true</consoleOutput>
<failsOnError>false</failsOnError>
<failsOnViolation>true</failsOnViolation>
<linkXref>false</linkXref>
</configuration>
</plugin>
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-compiler-plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${compiler.plugin.version}</version>
<configuration>
<source>${java.source}</source>
<target>${java.target}</target>
<showWarnings>true</showWarnings>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-project-info-reports-plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.0.0</version>
</plugin>
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-javadoc-plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<reportSets>
<reportSet>
<reports>
<report>javadoc</report>
</reports>
</reportSet>
</reportSets>
</plugin>
<!-- https://mvnrepository.com/artifact/org.codehaus.mojo/versions-maven-plugin -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>${versions.plugin.version}</version>
<reportSets>
<reportSet>
<reports>
<report>dependency-updates-report</report>
<report>plugin-updates-report</report>
<report>property-updates-report</report>
</reports>
</reportSet>
</reportSets>
</plugin>
</plugins>
</reporting>
To make matters even more confusing, I have another project that behaves exactly the opposite way: mvn site works correctly, but mvn package site creates the error:
Exit code: 2 - javadoc: error - No source files for package org.larrick.commons
Any insights on this would be greatly appreciated.
BTW: I'm using JDK 11 and Maven 3.6.3.
This appears to be an issue with the Javadoc plugin. Without the build step there's no artifact defined for the project, so the target/classes path (or the target .jar file) isn't added to the --module-path argument for Javadoc.
I'm reaching out to the Maven plugin team to identify a fix.

can't download plugins from my nexus-maven repository

like you probably know I am a DevOps engineer and to get my degree I have to present a project
I reached a point where I have to compile a maven project offline
my instructor imposed a nexus repository, I got settings.xml of my maven configured to connect and download the repositories from Nexus (which the first time connects and download from the maven central) and to connect with a proxy, same thing with my Nexus server, my problem is with the download of the plugins, I followed this link and put the maven repository provisioner plugin but when I write the command mvn clean install on my project, I get the 503 error (the screenshot will be uploded at the end), my goal is to successfully compile and generate the .ear for the project so I can deploy it on a server, thanks in advance sceenshot link pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<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>com.star</groupId>
<artifactId>Simulation</artifactId>
<packaging>pom</packaging>
<name>Simulation Project</name>
<version>1.0</version>
<properties>
<application.version>2.2</application.version>
<jboss.home>C:/jboss-eap-6.1-aya</jboss.home>
<!-- ************** -->
<!-- Build settings -->
<!-- ************** -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- maven-compiler-plugin -->
<maven.compiler.target>1.6</maven.compiler.target>
<maven.compiler.source>1.6</maven.compiler.source>
<!-- Options to override the compiler arguments directly on the compiler
arument line to separate between what the IDE understands as the source level
and what the Maven compiler actually use. -->
<maven.compiler.argument.target>${maven.compiler.target}</maven.compiler.argument.target>
<maven.compiler.argument.source>${maven.compiler.source}</maven.compiler.argument.source>
<maven.build.timestamp.format>yyyy-MM-dd</maven.build.timestamp.format>
</properties>
<profiles>
<!-- The configuration of the development profile -->
<profile>
<id>dev</id>
<!-- The development profile is active by default -->
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<build.profile.id>dev</build.profile.id>
</properties>
</profile>
<!-- The configuration of the production profile -->
<profile>
<id>prep</id>
<properties>
<build.profile.id>prep</build.profile.id>
</properties>
</profile>
<!-- The configuration of the testing profile -->
<profile>
<id>prod</id>
<properties>
<build.profile.id>prod</build.profile.id>
</properties>
</profile>
</profiles>
<modules>
<module>Simulation-ear</module>
<module>Simulation-ejb</module>
<module>Simulation-war</module>
</modules>
<build>
<filters>
<filter>../env.${build.profile.id}.properties</filter>
</filters>
<defaultGoal>package</defaultGoal>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12</version>
<configuration>
<excludedGroups>${tests.excludedGroups}</excludedGroups>
</configuration>
</plugin>
<plugin>
<artifactId>maven-ear-plugin</artifactId>
<version>2.7</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.7</version>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.5</version>
</plugin>
<!--This plugin's configuration is used to store Eclipse m2e settings
only. It has no influence on the Maven build itself. -->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<versionRange>[1.0,)</versionRange>
<goals>
<goal>unpack</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute>
<runOnIncremental>false</runOnIncremental>
</execute>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
<plugin>
<groupId>org.jboss.as.plugins</groupId>
<artifactId>jboss-as-maven-plugin</artifactId>
<version>7.1.1.Final</version>
<executions>
<execution>
<phase></phase>
<goals>
<goal>deploy</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.5</version>
</plugin>
<plugin>
<artifactId>maven-ejb-plugin</artifactId>
<version>2.3</version>
<configuration>
<ejbVersion>3.0</ejbVersion>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
</manifest>
<manifestEntries>
<Implementation-Version>${bioweb.version}_${maven.build.timestamp}</Implementation-Version>
</manifestEntries>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
</manifest>
<manifestEntries>
<Implementation-Version>${bioweb.version}_${maven.build.timestamp}</Implementation-Version>
</manifestEntries>
</archive>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<inherited>true</inherited>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<warName>${project.build.finalName}</warName>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
</manifest>
<manifestEntries>
<Implementation-Version>${bioweb.version}_${maven.build.timestamp}</Implementation-Version>
</manifestEntries>
</archive>
<webResources>
<resource>
<filtering>true</filtering>
<directory>src/main/webapp</directory>
<includes>
<include>**/web.xml</include>
</includes>
</resource>
</webResources>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>${cxf.version}</version>
</plugin>
</plugins>
</pluginManagement>
</build>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.star</groupId>
<artifactId>Simulation-ejb</artifactId>
<version>${application.version}</version>
<type>ejb</type>
</dependency>
<dependency>
<groupId>com.star</groupId>
<artifactId>Simulation-war</artifactId>
<version>${application.version}</version>
<type>war</type>
</dependency>
<dependency>
<groupId>com.star</groupId>
<artifactId>Simulation-ear</artifactId>
<version>${application.version}</version>
<type>ear</type>
</dependency>
</dependencies>
</dependencyManagement>
</project>
the problem was resolved by adding the nexus server ip to toproxy section in the settings.xml of the maven

Checker framework cant resolve symbol<annotatedJdk>${org.checkerframework:jdk8:jar}</annotatedJdk> issue

Im trying to add Checker Framework via Maven repository i followed checker framework manual steps but i got this error on intelij ide
someone else mentioned having same issue on Google groups please any help is appreciated
my maven package is like this
<properties>
<annotatedJdk>${org.checkerframework:jdk8:jar}</annotatedJdk>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.checkerframework</groupId>
<artifactId>checker-qual</artifactId>
<version>2.5.1</version>
</dependency>
<dependency>
<groupId>org.checkerframework</groupId>
<artifactId>jdk8</artifactId>
<version>2.5.1</version>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<compilerArguments>
<Xmaxerrs>10000</Xmaxerrs>
<Xmaxwarns>10000</Xmaxwarns>
</compilerArguments>
<annotationProcessorPaths>
<path>
<groupId>org.checkerframework</groupId>
<artifactId>checker</artifactId>
<version>2.5.1</version>
</path>
</annotationProcessorPaths>
<annotationProcessors><annotationProcessor>org.checkerframework.checker.nullness.NullnessChecker</annotationProcessor>
</annotationProcessors>
<compilerArgs>
<arg>-AprintErrorStack</arg>
<arg>-Xbootclasspath/p:${annotatedJdk}</arg>
</compilerArgs>
</configuration>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.0.0</version>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>properties</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.20.1</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
</plugins>
</build>
tell me if miss any steps it also does not allow deleting that line with error
Assuming that the project is built by Maven from command line correctly, this looks like IntelliJ IDEA highlighting issue: IDEA-129269/IDEA-187553.
The way I was able to avoid this issue is to declare the properties as follows:
<checkerframework.version>2.5.6</checkerframework.version>
<annotatedJdk>${settings.localRepository}/org/checkerframework/jdk8/${checkerframework.version}/jdk8-${checkerframework.version}.jar</annotatedJdk>
Then re-import the Maven project.
Also note that with this it may not be necessary to configure the maven-dependency-plugin either.

Maven site not link to Jacoco report

I can generate Jacoco report from profile 'test' and is save inside site folder. But when I execute profile 'documentacion' which contains site generation description, I get all reports link in site, except link to Jacoco report, but this report still appears inside site folder.
This is part of my POM (I cut down part which is not important):
<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>
<!-- Tests -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<!-- Dependencia para el informe de traducción -->
<dependency>
<groupId>com.googlecode.l10n-maven-plugin</groupId>
<artifactId>l10n-maven-plugin</artifactId>
<version>1.8</version>
</dependency>
....
</dependencies>
<!-- Configuración común a todas las fases -->
<build>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.fxml</include>
</includes>
<excludes>
<exclude>package-info.java</exclude>
</excludes>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>**/*.xml</include>
<include>**/*.css</include>
<include>**/*.png</include>
<include>**/*.fxml</include>
<include>**/*.ttf</include>
<include>*.properties</include>
<include>version.prop</include>
</includes>
</resource>
</resources>
</build>
<!-- Perfiles -->
<profiles>
......
<profile>
<id>documentacion</id>
<activation>
<jdk>[1.8,)</jdk>
</activation>
<build>
<defaultGoal>site:site</defaultGoal>
<plugins>
<!-- Site -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.4</version>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.2.201409121644</version>
</plugin>
</plugins>
</build>
<reporting>
<excludeDefaults>true</excludeDefaults>
<outputDirectory>${project.build.directory}/site</outputDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.8</version>
<configuration>
<dependencyLocationsEnabled>false</dependencyLocationsEnabled>
</configuration>
<reportSets>
<reportSet>
<reports>
<report>summary</report>
<report>index</report>
<report>dependencies</report>
<report>project-team</report>
<report>license</report>
<report>scm</report>
<report>cim</report>
<report>mailing-list</report>
<report>issue-tracking</report>
</reports>
</reportSet>
</reportSets>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>3.3</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.13</version>
<configuration>
<configLocation>config/sun_checks.xml</configLocation>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
<version>2.5</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>3.0.0</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>l10n-maven-plugin</artifactId>
<version>1.0-alpha-2</version>
<configuration>
<locales>
<locale>es</locale>
</locales>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-changes-plugin</artifactId>
<version>2.11</version>
<reportSets>
<reportSet>
<reports>
<report>changes-report</report>
</reports>
</reportSet>
</reportSets>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.1</version>
<configuration>
<useStandardDocletOptions>false</useStandardDocletOptions>
<additionalparam>-Xdoclint:none</additionalparam>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.18.1</version>
</plugin>
</plugins>
</reporting>
</profile>
<profile>
<id>test</id>
<activation>
<jdk>[1.8,)</jdk>
</activation>
<build>
<defaultGoal>validate test</defaultGoal>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
<additionalClasspathElements>
<additionalClasspathElement>${java.home}/lib/jfxrt.jar</additionalClasspathElement>
</additionalClasspathElements>
<argLine>-Dfile.encoding=UTF-8</argLine>
<skipTests>${skip.unit.tests}</skipTests>
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.2.201409121644</version>
<executions>
<execution>
<id>pre-unit-test</id>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<destFile>${project.build.directory}/coverage-reports/jacoco.exec</destFile>
<propertyName>surefireArgLine</propertyName>
</configuration>
</execution>
<execution>
<id>post-unit-test</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<dataFile>${project.build.directory}/coverage-reports/jacoco.exec</dataFile>
<outputDirectory>${project.reporting.outputDirectory}/jacoco</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
So, How can I get site link to Jacoco report?
Finally, I can fix my POM so I get links to Jacoco and Surefire reports from maven site.
<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>
...
<dependencies>
<!-- Tests -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
...
</dependencies>
<profiles>
<profile>
<id>desarrollo</id>
<activation>
<jdk>[1.8,)</jdk>
</activation>
<build>
<defaultGoal>clean package</defaultGoal>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.5</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>com.***.App</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>documentacion</id>
<activation>
<jdk>[1.8,)</jdk>
</activation>
<build>
<defaultGoal>site:site</defaultGoal>
<plugins>
<!-- Site -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.4</version>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.2.201409121644</version>
</plugin>
</plugins>
</build>
<reporting>
<excludeDefaults>true</excludeDefaults>
<outputDirectory>${project.build.directory}/site</outputDirectory>
<plugins>
<!-- Plugin para generar el site con los reports -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.8</version>
<configuration>
<dependencyLocationsEnabled>false</dependencyLocationsEnabled>
</configuration>
<reportSets>
<reportSet>
<reports>
<report>summary</report>
<report>index</report>
<report>dependencies</report>
<report>project-team</report>
<report>license</report>
<report>scm</report>
<report>cim</report>
<report>mailing-list</report>
<report>issue-tracking</report>
</reports>
</reportSet>
</reportSets>
</plugin>
<!-- Reporte tests -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.18.1</version>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.2.201409121644</version>
</plugin>
<!-- More report plugins place here (PMD, checkstyle...) -->
</plugins>
</reporting>
</profile>
<profile>
<id>test</id>
<activation>
<jdk>[1.8,)</jdk>
</activation>
<build>
<defaultGoal>validate test</defaultGoal>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<outputDirectory>${project.build.directory}/site</outputDirectory>
<reportsDirectories>
<reportsDirectories>${project.build.directory}/site/surefire-reports</reportsDirectories>
</reportsDirectories>
<testFailureIgnore>true</testFailureIgnore>
<additionalClasspathElements>
<additionalClasspathElement>${java.home}/lib/jfxrt.jar</additionalClasspathElement>
</additionalClasspathElements>
<argLine>${argLine} -Dfile.encoding=UTF-8</argLine>
</configuration>
<executions>
<execution>
<id>default-test</id>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Test report -->
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.2.201409121644</version>
<executions>
<execution>
<id>default-prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>default-report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
<execution>
<id>default-check</id>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

How to avoid maven profile duplication

I have a maven project for a webapp, which repack war dependency using overlays. For two profiles, test and prod, it should exclude demo.jsp file, but for other, for example local, this file should stay. Is there a way to have only one configuration for two profiles? I don't want to repeat one configuration for two profiles.
My current solution:
<profiles>
<profile>
<id>test</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<overlays>
<overlay>
<groupId>mygroup</groupId>
<artifactId>mywebapp</artifactId>
<excludes>
<exclude>demo.jsp</exclude>
</excludes>
</overlay>
</overlays>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>prod</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<overlays>
<overlay>
<groupId>mygroup</groupId>
<artifactId>mywebapp</artifactId>
<excludes>
<exclude>demo.jsp</exclude>
</excludes>
</overlay>
</overlays>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
EDIT: test and prod profiles are identical
The Plugin Management may help us as the following :-
<build>
<pluginManagement>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<overlays>
<overlay>
<groupId>mygroup</groupId>
<artifactId>mywebapp</artifactId>
<excludes>
<exclude>demo.jsp</exclude>
</excludes>
</overlay>
</overlays>
</configuration>
</plugin>
</pluginManagement>
</build>
Then the profiles should be as the following: -
<profiles>
<profile>
<id>test</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
</plugin>
</plugins>
</build>
...
</profile>
<profile>
<id>prod</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
</plugin>
</plugins>
</build>
...
</profile>
</profiles>
I hope this may help.

Resources