diff --git a/.travis.yml b/.travis.yml
index d2e53d3..ca2068a 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -2,6 +2,4 @@ language: java
script: mvn -e clean install site
jdk:
- oraclejdk8
- - oraclejdk7
- openjdk7
- - openjdk6
diff --git a/Jenkinsfile b/Jenkinsfile
new file mode 100644
index 0000000..808ce01
--- /dev/null
+++ b/Jenkinsfile
@@ -0,0 +1,38 @@
+properties([[
+ $class: 'BuildDiscarderProperty',
+ strategy: [
+ $class: 'LogRotator',
+ artifactDaysToKeepStr: '-1',
+ artifactNumToKeepStr: '10',
+ daysToKeepStr: '-1',
+ numToKeepStr: '10'
+ ]
+]])
+
+node {
+ timestamps {
+ stage('Pre Build Cleanup') {
+ step($class: 'WsCleanup')
+ }
+ stage('Checkout') {
+ checkout scm
+ }
+
+ withMaven(maven: 'MVN-3', jdk: 'JDK-8', mavenLocalRepo: '.repository') {
+ stage('Build') {
+ sh 'mvn -e install site -DskipTests'
+ }
+ stage('Test') {
+ sh 'mvn -e test'
+ junit 'target/surefire-reports/TEST-*.xml'
+ }
+ }
+
+ stage('Archive') {
+ archiveArtifacts artifacts: 'target/*.jar', fingerprint: true
+ }
+ stage('Post Build Cleanup') {
+ step($class: 'WsCleanup')
+ }
+ }
+}
\ No newline at end of file
diff --git a/README.md b/README.md
index 05cd6b5..384aeed 100644
--- a/README.md
+++ b/README.md
@@ -3,18 +3,18 @@
[![Build Status](https://travis-ci.org/gabrysbiz/maven-plugin-utils.svg?branch=master)](https://travis-ci.org/gabrysbiz/maven-plugin-utils)
Maven Plugin Utils is a Java library which contains utilities for [Maven 2](https://maven.apache.org/) plugins. It contains tools to:
-* scan directories for files and create a virtual (not physical) destination file in the output directory based on the source (see [biz.gabrys.maven.plugin.util.io](http://maven-plugin-utils.projects.gabrys.biz/1.4.0/apidocs/index.html?biz/gabrys/maven/plugin/util/io/package-summary.html) package)
-* log Mojos parameters (see [biz.gabrys.maven.plugin.util.parameter](http://maven-plugin-utils.projects.gabrys.biz/1.4.0/apidocs/index.html?biz/gabrys/maven/plugin/util/parameter/package-summary.html) package)
-* manage classpath (see [biz.gabrys.maven.plugin.util.classpath](http://maven-plugin-utils.projects.gabrys.biz/1.4.0/apidocs/index.html?biz/gabrys/maven/plugin/util/classpath/package-summary.html) package)
-* count execution time (see [biz.gabrys.maven.plugin.util.timer](http://maven-plugin-utils.projects.gabrys.biz/1.4.0/apidocs/index.html?biz/gabrys/maven/plugin/util/timer/package-summary.html) package)
+* scan directories for files and create a virtual (not physical) destination file in the output directory based on the source (see [biz.gabrys.maven.plugin.util.io](http://maven-plugin-utils.projects.gabrys.biz/1.4.1/apidocs/index.html?biz/gabrys/maven/plugin/util/io/package-summary.html) package)
+* log Mojos parameters (see [biz.gabrys.maven.plugin.util.parameter](http://maven-plugin-utils.projects.gabrys.biz/1.4.1/apidocs/index.html?biz/gabrys/maven/plugin/util/parameter/package-summary.html) package)
+* manage classpath (see [biz.gabrys.maven.plugin.util.classpath](http://maven-plugin-utils.projects.gabrys.biz/1.4.1/apidocs/index.html?biz/gabrys/maven/plugin/util/classpath/package-summary.html) package)
+* count execution time (see [biz.gabrys.maven.plugin.util.timer](http://maven-plugin-utils.projects.gabrys.biz/1.4.1/apidocs/index.html?biz/gabrys/maven/plugin/util/timer/package-summary.html) package)
-Read [API documentation](http://maven-plugin-utils.projects.gabrys.biz/1.4.0/apidocs/) for more information.
+Read [API documentation](http://maven-plugin-utils.projects.gabrys.biz/1.4.1/apidocs/) for more information.
# Requirements
The library to run requires:
* Java 5.0 or higher
-* Third-Party Dependencies ([see list](http://maven-plugin-utils.projects.gabrys.biz/1.4.0/dependencies.html))
+* Third-Party Dependencies ([see list](http://maven-plugin-utils.projects.gabrys.biz/1.4.1/dependencies.html))
# Download
-You can download the library from [this page](http://maven-plugin-utils.projects.gabrys.biz/1.4.0/download.html)
-or using various [dependency management tools](http://maven-plugin-utils.projects.gabrys.biz/1.4.0/dependency-info.html).
+You can download the library from [this page](http://maven-plugin-utils.projects.gabrys.biz/1.4.1/download.html)
+or using various [dependency management tools](http://maven-plugin-utils.projects.gabrys.biz/1.4.1/dependency-info.html).
diff --git a/pom.xml b/pom.xml
index 981a55f..940f24f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,10 +5,10 @@
biz.gabrys.maven
plugin-utils
- 1.4.0
+ 1.4.1
Maven Plugin Utils
A Java library which contains utilities for Maven 2 plugins.
- http://maven-plugin-utils.projects.gabrys.biz/1.4.0/
+ http://maven-plugin-utils.projects.gabrys.biz/1.4.1/
2015
@@ -57,7 +57,7 @@
ossrh
- https://oss.sonatype.org/service/local/staging/deploy/maven2/
+ https://oss.sonatype.org/service/local/staging/deploy/maven2
@@ -101,6 +101,7 @@
org.mockito
mockito-core
+
1.10.19
test
@@ -119,7 +120,7 @@
maven-compiler-plugin
- 3.6.0
+ 3.7.0
maven-deploy-plugin
@@ -158,11 +159,11 @@
maven-resources-plugin
- 3.0.1
+ 3.0.2
maven-site-plugin
- 3.5.1
+ 3.6
maven-source-plugin
@@ -170,7 +171,7 @@
maven-surefire-plugin
- 2.19.1
+ 2.20.1
com.mycila
@@ -192,7 +193,7 @@
org.jacoco
jacoco-maven-plugin
- 0.7.7.201606060606
+ 0.7.9
diff --git a/src/main/java/biz/gabrys/maven/plugin/util/io/LoggingFileFilter.java b/src/main/java/biz/gabrys/maven/plugin/util/io/LoggingFileFilter.java
index 17b5395..998ad7f 100644
--- a/src/main/java/biz/gabrys/maven/plugin/util/io/LoggingFileFilter.java
+++ b/src/main/java/biz/gabrys/maven/plugin/util/io/LoggingFileFilter.java
@@ -50,9 +50,6 @@ public LoggingFileFilter(final IOFileFilter filter, final Log logger) {
*/
public boolean accept(final File file) {
final boolean accepted = filter.accept(file);
- if (!logger.isDebugEnabled()) {
- return accepted;
- }
LoggerUtils.debugInclusion(logger, file, accepted);
return accepted;
}
@@ -64,10 +61,9 @@ public boolean accept(final File file) {
*/
public boolean accept(final File dir, final String name) {
final boolean accepted = filter.accept(dir, name);
- if (!logger.isDebugEnabled()) {
- return accepted;
+ if (logger.isDebugEnabled()) {
+ LoggerUtils.debugInclusion(logger, new File(dir, name), accepted);
}
- LoggerUtils.debugInclusion(logger, new File(dir, name), accepted);
return accepted;
}
}
diff --git a/src/main/java/biz/gabrys/maven/plugin/util/parameter/ParametersLogBuilder.java b/src/main/java/biz/gabrys/maven/plugin/util/parameter/ParametersLogBuilder.java
index a055f7f..b049415 100644
--- a/src/main/java/biz/gabrys/maven/plugin/util/parameter/ParametersLogBuilder.java
+++ b/src/main/java/biz/gabrys/maven/plugin/util/parameter/ParametersLogBuilder.java
@@ -326,14 +326,18 @@ protected String createParameterValue(final Container container) {
final ValueToStringConverter converter = container.getConverter();
final Object value = container.getValue();
- line.append(converter.convert(value));
+ final String valueText = String.valueOf(converter.convert(value));
+ line.append(valueText);
final ValueSanitizer sanitizer = container.getSanitizer();
if (!sanitizer.isValid(value)) {
- line.append(" (calculated: ");
- final Object correctedValue = sanitizer.sanitize(value);
- line.append(converter.convert(correctedValue));
- line.append(')');
+ final Object calculatedValue = sanitizer.sanitize(value);
+ final String calculatedValueText = String.valueOf(converter.convert(calculatedValue));
+ if (!valueText.equals(calculatedValueText)) {
+ line.append(" (calculated: ");
+ line.append(calculatedValueText);
+ line.append(')');
+ }
}
return line.toString();
}
diff --git a/src/site/site.xml b/src/site/site.xml
index 4ba8794..e8e119d 100644
--- a/src/site/site.xml
+++ b/src/site/site.xml
@@ -10,7 +10,7 @@
org.apache.maven.skins
maven-fluido-skin
- 1.5
+ 1.6
diff --git a/src/test/java/biz/gabrys/maven/plugin/util/io/LoggingFileFilterTest.java b/src/test/java/biz/gabrys/maven/plugin/util/io/LoggingFileFilterTest.java
index 12e44ad..f0e8116 100644
--- a/src/test/java/biz/gabrys/maven/plugin/util/io/LoggingFileFilterTest.java
+++ b/src/test/java/biz/gabrys/maven/plugin/util/io/LoggingFileFilterTest.java
@@ -50,7 +50,7 @@ public void accept_loggerIsEnabled_logInfo() {
Mockito.verify(filter).accept(file);
Mockito.verify(fileFilter).accept(file);
- Mockito.verify(logger, Mockito.times(2)).isDebugEnabled();
+ Mockito.verify(logger).isDebugEnabled();
Mockito.verify(file).isFile();
Mockito.verify(file).getAbsolutePath();
Mockito.verify(logger).debug(Matchers.anyString());
diff --git a/src/test/java/biz/gabrys/maven/plugin/util/parameter/ParametersLogBuilderTest.java b/src/test/java/biz/gabrys/maven/plugin/util/parameter/ParametersLogBuilderTest.java
index 96901d9..b3590ff 100644
--- a/src/test/java/biz/gabrys/maven/plugin/util/parameter/ParametersLogBuilderTest.java
+++ b/src/test/java/biz/gabrys/maven/plugin/util/parameter/ParametersLogBuilderTest.java
@@ -367,4 +367,79 @@ public void createParameterValue_valueIsNotValid() {
Mockito.verifyNoMoreInteractions(builder, converter, sanitizer);
Mockito.verifyZeroInteractions(logger);
}
+
+ @Test
+ public void createParameterValue_valueIsNotValid_sanitizedValueIsTheSameAsValue() {
+ final Log logger = Mockito.mock(Log.class);
+ final ParametersLogBuilder builder = Mockito.spy(new ParametersLogBuilder(logger));
+
+ final String object = "object";
+
+ final Container container = Mockito.mock(Container.class);
+ Mockito.when(container.getValue()).thenReturn(object);
+
+ final ValueToStringConverter converter = Mockito.mock(ValueToStringConverter.class);
+ final String incorrectValue = "incorrect";
+ Mockito.when(converter.convert(object)).thenReturn(incorrectValue);
+ Mockito.when(container.getConverter()).thenReturn(converter);
+
+ final ValueSanitizer sanitizer = Mockito.mock(ValueSanitizer.class);
+ Mockito.when(sanitizer.isValid(object)).thenReturn(Boolean.FALSE);
+ final String sanitized = "sanitized";
+ Mockito.when(sanitizer.sanitize(object)).thenReturn(sanitized);
+ Mockito.when(container.getSanitizer()).thenReturn(sanitizer);
+
+ Mockito.when(converter.convert(sanitized)).thenReturn(incorrectValue);
+
+ final String value = builder.createParameterValue(container);
+
+ Assert.assertEquals("Value.", incorrectValue, value);
+ Mockito.verify(builder).createParameterValue(container);
+ Mockito.verify(container).getConverter();
+ Mockito.verify(container).getValue();
+ Mockito.verify(converter).convert(object);
+ Mockito.verify(container).getSanitizer();
+ Mockito.verify(sanitizer).isValid(object);
+ Mockito.verify(sanitizer).sanitize(object);
+ Mockito.verify(converter).convert(sanitized);
+ Mockito.verifyNoMoreInteractions(builder, converter, sanitizer);
+ Mockito.verifyZeroInteractions(logger);
+ }
+
+ @Test
+ public void createParameterValue_valueIsNull_sanitizedValueIsNullText() {
+ final Log logger = Mockito.mock(Log.class);
+ final ParametersLogBuilder builder = Mockito.spy(new ParametersLogBuilder(logger));
+
+ final String object = "object";
+
+ final Container container = Mockito.mock(Container.class);
+ Mockito.when(container.getValue()).thenReturn(object);
+
+ final ValueToStringConverter converter = Mockito.mock(ValueToStringConverter.class);
+ Mockito.when(converter.convert(object)).thenReturn(null);
+ Mockito.when(container.getConverter()).thenReturn(converter);
+
+ final ValueSanitizer sanitizer = Mockito.mock(ValueSanitizer.class);
+ Mockito.when(sanitizer.isValid(object)).thenReturn(Boolean.FALSE);
+ final String sanitized = "sanitized";
+ Mockito.when(sanitizer.sanitize(object)).thenReturn(sanitized);
+ Mockito.when(container.getSanitizer()).thenReturn(sanitizer);
+
+ Mockito.when(converter.convert(sanitized)).thenReturn("null");
+
+ final String value = builder.createParameterValue(container);
+
+ Assert.assertEquals("Value.", "null", value);
+ Mockito.verify(builder).createParameterValue(container);
+ Mockito.verify(container).getConverter();
+ Mockito.verify(container).getValue();
+ Mockito.verify(converter).convert(object);
+ Mockito.verify(container).getSanitizer();
+ Mockito.verify(sanitizer).isValid(object);
+ Mockito.verify(sanitizer).sanitize(object);
+ Mockito.verify(converter).convert(sanitized);
+ Mockito.verifyNoMoreInteractions(builder, converter, sanitizer);
+ Mockito.verifyZeroInteractions(logger);
+ }
}
diff --git a/xdocs/changelog.xml b/xdocs/changelog.xml
index ead69b2..f425857 100644
--- a/xdocs/changelog.xml
+++ b/xdocs/changelog.xml
@@ -7,31 +7,38 @@
+
+ Bugs:
+
+ - Stopped logging calculated value when it is the same as the primary value
+
+