diff --git a/maven-core/pom.xml b/maven-core/pom.xml
index 9dd0250754e4..5ff2215e2420 100644
--- a/maven-core/pom.xml
+++ b/maven-core/pom.xml
@@ -217,7 +217,40 @@ under the License.
- modello-site-doc
+ modello-site-docs-cache
+ pre-site
+
+ xdoc
+ xsd
+
+
+ 1.0.0
+
+ src/main/mdo/cache-domain.mdo
+
+
+
+
+ modello-cache
+
+ java
+ xpp3-reader
+ xpp3-writer
+ xsd
+
+
+ 1.0.0
+
+ src/main/mdo/cache-config.mdo
+ src/main/mdo/cache-domain.mdo
+ src/main/mdo/cache-diff.mdo
+ src/main/mdo/cache-report.mdo
+
+ ${basedir}/target/generated-sources/modello
+
+
+
+ modello-site-docs-extension
pre-site
xdoc
@@ -248,6 +281,7 @@ under the License.
+
diff --git a/maven-core/src/main/java/org/apache/maven/caching/ArtifactsRepository.java b/maven-core/src/main/java/org/apache/maven/caching/ArtifactsRepository.java
index 65315498c7ff..968bae24b759 100644
--- a/maven-core/src/main/java/org/apache/maven/caching/ArtifactsRepository.java
+++ b/maven-core/src/main/java/org/apache/maven/caching/ArtifactsRepository.java
@@ -20,7 +20,7 @@
*/
import org.apache.maven.artifact.Artifact;
-import org.apache.maven.caching.jaxb.CacheReportType;
+import org.apache.maven.caching.domain.CacheReportType;
import org.apache.maven.caching.xml.BuildInfo;
import org.apache.maven.execution.MavenSession;
diff --git a/maven-core/src/main/java/org/apache/maven/caching/CacheContext.java b/maven-core/src/main/java/org/apache/maven/caching/CacheContext.java
index 569286d8b841..49b552ea8742 100644
--- a/maven-core/src/main/java/org/apache/maven/caching/CacheContext.java
+++ b/maven-core/src/main/java/org/apache/maven/caching/CacheContext.java
@@ -19,7 +19,7 @@
* under the License.
*/
-import org.apache.maven.caching.jaxb.ProjectsInputInfoType;
+import org.apache.maven.caching.domain.ProjectsInputInfoType;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.project.MavenProject;
diff --git a/maven-core/src/main/java/org/apache/maven/caching/CacheControllerImpl.java b/maven-core/src/main/java/org/apache/maven/caching/CacheControllerImpl.java
index ad9d490c6ebb..05e56a5b9828 100644
--- a/maven-core/src/main/java/org/apache/maven/caching/CacheControllerImpl.java
+++ b/maven-core/src/main/java/org/apache/maven/caching/CacheControllerImpl.java
@@ -31,18 +31,18 @@
import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager;
import org.apache.maven.caching.checksum.KeyUtils;
import org.apache.maven.caching.checksum.MavenProjectInput;
+import org.apache.maven.caching.domain.Scm;
import org.apache.maven.caching.hash.HashAlgorithm;
import org.apache.maven.caching.hash.HashFactory;
-import org.apache.maven.caching.jaxb.ArtifactType;
-import org.apache.maven.caching.jaxb.BuildDiffType;
-import org.apache.maven.caching.jaxb.BuildInfoType;
-import org.apache.maven.caching.jaxb.CacheReportType;
-import org.apache.maven.caching.jaxb.CompletedExecutionType;
-import org.apache.maven.caching.jaxb.DigestItemType;
-import org.apache.maven.caching.jaxb.ProjectReportType;
-import org.apache.maven.caching.jaxb.ProjectsInputInfoType;
-import org.apache.maven.caching.jaxb.PropertyNameType;
-import org.apache.maven.caching.jaxb.TrackedPropertyType;
+import org.apache.maven.caching.domain.ArtifactType;
+import org.apache.maven.caching.domain.BuildDiffType;
+import org.apache.maven.caching.domain.CacheReportType;
+import org.apache.maven.caching.domain.CompletedExecutionType;
+import org.apache.maven.caching.domain.DigestItemType;
+import org.apache.maven.caching.domain.ProjectReportType;
+import org.apache.maven.caching.domain.ProjectsInputInfoType;
+import org.apache.maven.caching.domain.PropertyNameType;
+import org.apache.maven.caching.domain.TrackedPropertyType;
import org.apache.maven.caching.xml.BuildInfo;
import org.apache.maven.caching.xml.CacheConfig;
import org.apache.maven.caching.xml.CacheSource;
@@ -67,7 +67,6 @@
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
-import java.math.BigInteger;
import java.nio.charset.StandardCharsets;
import java.nio.file.FileVisitResult;
import java.nio.file.Files;
@@ -143,7 +142,7 @@ public class CacheControllerImpl implements CacheController
private final ConcurrentMap cacheResults = new ConcurrentHashMap<>();
- private volatile BuildInfoType.Scm scm;
+ private volatile Scm scm;
@Override
@Nonnull
@@ -434,7 +433,7 @@ public void save( CacheResult cacheResult, List mojoExecutions,
final BuildInfo buildInfo = new BuildInfo( session.getGoals(), projectArtifactDto, attachedArtifactDtos,
context.getInputInfo(), completedExecution, hashFactory.getAlgorithm() );
populateGitInfo( buildInfo, session );
- buildInfo.getDto().setFinal( cacheConfig.isSaveFinal() );
+ buildInfo.getDto().set_final( cacheConfig.isSaveFinal() );
cacheResults.put( getVersionlessProjectKey( project ), rebuilded( cacheResult, buildInfo ) );
// if package phase presence means new artifacts were packaged
@@ -554,7 +553,7 @@ private ArtifactType artifactDto( Artifact projectArtifact, HashAlgorithm algori
{
final Path file = projectArtifact.getFile().toPath();
dto.setFileHash( algorithm.hash( file ) );
- dto.setFileSize( BigInteger.valueOf( Files.size( file ) ) );
+ dto.setFileSize( Files.size( file ) );
}
return dto;
}
@@ -798,7 +797,7 @@ private void populateGitInfo( BuildInfo buildInfo, MavenSession session ) throws
}
catch ( IOException e )
{
- scm = new BuildInfoType.Scm();
+ scm = new Scm();
logger.error( "Cannot populate git info", e );
}
}
diff --git a/maven-core/src/main/java/org/apache/maven/caching/CacheDiff.java b/maven-core/src/main/java/org/apache/maven/caching/CacheDiff.java
index 9e066a598eff..5808e1807426 100644
--- a/maven-core/src/main/java/org/apache/maven/caching/CacheDiff.java
+++ b/maven-core/src/main/java/org/apache/maven/caching/CacheDiff.java
@@ -22,13 +22,13 @@
import com.google.common.base.Optional;
import com.google.common.collect.Sets;
import org.apache.commons.lang3.StringUtils;
-import org.apache.maven.caching.jaxb.BuildDiffType;
-import org.apache.maven.caching.jaxb.BuildInfoType;
-import org.apache.maven.caching.jaxb.CompletedExecutionType;
-import org.apache.maven.caching.jaxb.DigestItemType;
-import org.apache.maven.caching.jaxb.MismatchType;
-import org.apache.maven.caching.jaxb.ProjectsInputInfoType;
-import org.apache.maven.caching.jaxb.PropertyValueType;
+import org.apache.maven.caching.domain.BuildDiffType;
+import org.apache.maven.caching.domain.BuildInfoType;
+import org.apache.maven.caching.domain.CompletedExecutionType;
+import org.apache.maven.caching.domain.DigestItemType;
+import org.apache.maven.caching.domain.MismatchType;
+import org.apache.maven.caching.domain.ProjectsInputInfoType;
+import org.apache.maven.caching.domain.PropertyValueType;
import org.apache.maven.caching.xml.CacheConfig;
import java.util.ArrayList;
@@ -232,23 +232,23 @@ private void compareDependencies( ProjectsInputInfoType current, ProjectsInputIn
}
- private void compareExecutions( BuildInfoType.Executions current, BuildInfoType.Executions baseline )
+ private void compareExecutions( List current, List baseline )
{
Map baselineExecutionsByKey = new HashMap<>();
- for ( CompletedExecutionType completedExecutionType : baseline.getExecution() )
+ for ( CompletedExecutionType completedExecutionType : baseline )
{
baselineExecutionsByKey.put( completedExecutionType.getExecutionKey(), completedExecutionType );
}
Map currentExecutionsByKey = new HashMap<>();
- for ( CompletedExecutionType e1 : current.getExecution() )
+ for ( CompletedExecutionType e1 : current )
{
currentExecutionsByKey.put( e1.getExecutionKey(), e1 );
}
// such situation normally means different poms and mismatch in effective poms,
// but in any case it is helpful to report
- for ( CompletedExecutionType baselineExecution : baseline.getExecution() )
+ for ( CompletedExecutionType baselineExecution : baseline )
{
if ( !currentExecutionsByKey.containsKey( baselineExecution.getExecutionKey() ) )
{
@@ -261,7 +261,7 @@ private void compareExecutions( BuildInfoType.Executions current, BuildInfoType.
}
}
- for ( CompletedExecutionType currentExecution : current.getExecution() )
+ for ( CompletedExecutionType currentExecution : current )
{
if ( !baselineExecutionsByKey.containsKey( currentExecution.getExecutionKey() ) )
{
@@ -285,7 +285,7 @@ private void comparePlugins( CompletedExecutionType current, CompletedExecutionT
{
// TODO add support for skip values
final List trackedProperties = new ArrayList<>();
- for ( PropertyValueType propertyValueType : current.getConfiguration().getProperty() )
+ for ( PropertyValueType propertyValueType : current.getConfiguration() )
{
if ( propertyValueType.isTracked() )
{
@@ -298,7 +298,7 @@ private void comparePlugins( CompletedExecutionType current, CompletedExecutionT
}
final Map baselinePropertiesByName = new HashMap<>();
- for ( PropertyValueType propertyValueType : baseline.getConfiguration().getProperty() )
+ for ( PropertyValueType propertyValueType : baseline.getConfiguration() )
{
baselinePropertiesByName.put( propertyValueType.getName(), propertyValueType );
}
diff --git a/maven-core/src/main/java/org/apache/maven/caching/CacheEventSpy.java b/maven-core/src/main/java/org/apache/maven/caching/CacheEventSpy.java
index c6c9a202b380..3cd5578d9be3 100644
--- a/maven-core/src/main/java/org/apache/maven/caching/CacheEventSpy.java
+++ b/maven-core/src/main/java/org/apache/maven/caching/CacheEventSpy.java
@@ -19,6 +19,7 @@
* under the License.
*/
+import org.apache.maven.caching.xml.CacheConfig;
import org.apache.maven.eventspy.AbstractEventSpy;
import org.apache.maven.eventspy.EventSpy;
import org.apache.maven.execution.ExecutionEvent;
@@ -31,18 +32,24 @@
@Component( role = EventSpy.class )
public class CacheEventSpy extends AbstractEventSpy
{
+ @Requirement
+ private CacheConfig cacheConfig;
+
@Requirement
private CacheController cacheController;
@Override
public void onEvent( Object event ) throws Exception
{
- if ( event instanceof ExecutionEvent )
+ if ( cacheConfig.isEnabled() )
{
- ExecutionEvent executionEvent = (ExecutionEvent) event;
- if ( executionEvent.getType() == ExecutionEvent.Type.SessionEnded )
+ if ( event instanceof ExecutionEvent )
{
- cacheController.saveCacheReport( executionEvent.getSession() );
+ ExecutionEvent executionEvent = (ExecutionEvent) event;
+ if ( executionEvent.getType() == ExecutionEvent.Type.SessionEnded )
+ {
+ cacheController.saveCacheReport( executionEvent.getSession() );
+ }
}
}
}
diff --git a/maven-core/src/main/java/org/apache/maven/caching/CacheResult.java b/maven-core/src/main/java/org/apache/maven/caching/CacheResult.java
index 8d886764f8b8..84038a3311d8 100644
--- a/maven-core/src/main/java/org/apache/maven/caching/CacheResult.java
+++ b/maven-core/src/main/java/org/apache/maven/caching/CacheResult.java
@@ -117,6 +117,6 @@ public RestoreStatus getStatus()
public boolean isFinal()
{
- return buildInfo != null && buildInfo.getDto().isFinal();
+ return buildInfo != null && buildInfo.getDto().is_final();
}
}
diff --git a/maven-core/src/main/java/org/apache/maven/caching/DefaultPluginScanConfig.java b/maven-core/src/main/java/org/apache/maven/caching/DefaultPluginScanConfig.java
index 408d097cf10e..8229435ce65d 100644
--- a/maven-core/src/main/java/org/apache/maven/caching/DefaultPluginScanConfig.java
+++ b/maven-core/src/main/java/org/apache/maven/caching/DefaultPluginScanConfig.java
@@ -19,7 +19,7 @@
* under the License.
*/
-import org.apache.maven.caching.jaxb.DirScanConfigType;
+import org.apache.maven.caching.domain.DirScanConfigType;
import javax.annotation.Nonnull;
diff --git a/maven-core/src/main/java/org/apache/maven/caching/HttpRepositoryImpl.java b/maven-core/src/main/java/org/apache/maven/caching/HttpRepositoryImpl.java
index fbbe509bb28d..6747532bff42 100644
--- a/maven-core/src/main/java/org/apache/maven/caching/HttpRepositoryImpl.java
+++ b/maven-core/src/main/java/org/apache/maven/caching/HttpRepositoryImpl.java
@@ -33,10 +33,10 @@
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.caching.checksum.MavenProjectInput;
-import org.apache.maven.caching.jaxb.ArtifactType;
-import org.apache.maven.caching.jaxb.BuildInfoType;
-import org.apache.maven.caching.jaxb.CacheReportType;
-import org.apache.maven.caching.jaxb.ProjectReportType;
+import org.apache.maven.caching.domain.ArtifactType;
+import org.apache.maven.caching.domain.BuildInfoType;
+import org.apache.maven.caching.domain.CacheReportType;
+import org.apache.maven.caching.domain.ProjectReportType;
import org.apache.maven.caching.xml.BuildInfo;
import org.apache.maven.caching.xml.CacheConfig;
import org.apache.maven.caching.xml.CacheSource;
@@ -268,7 +268,7 @@ public Optional findBaselineBuild( MavenProject project )
{
String url;
final ProjectReportType projectReport = cachedProjectHolder.get();
- if ( projectReport.isSetUrl() )
+ if ( projectReport.getUrl() != null )
{
url = cachedProjectHolder.get().getUrl();
logInfo( "Retrieving baseline buildinfo: " + projectReport.getUrl(), project.getArtifactId() );
diff --git a/maven-core/src/main/java/org/apache/maven/caching/LocalArtifactsRepository.java b/maven-core/src/main/java/org/apache/maven/caching/LocalArtifactsRepository.java
index c5916b2c64ba..280c2be5943c 100644
--- a/maven-core/src/main/java/org/apache/maven/caching/LocalArtifactsRepository.java
+++ b/maven-core/src/main/java/org/apache/maven/caching/LocalArtifactsRepository.java
@@ -20,7 +20,7 @@
*/
import com.google.common.base.Optional;
-import org.apache.maven.caching.jaxb.ArtifactType;
+import org.apache.maven.caching.domain.ArtifactType;
import org.apache.maven.caching.xml.BuildInfo;
import org.apache.maven.caching.xml.CacheSource;
import org.apache.maven.execution.MavenSession;
diff --git a/maven-core/src/main/java/org/apache/maven/caching/LocalRepositoryImpl.java b/maven-core/src/main/java/org/apache/maven/caching/LocalRepositoryImpl.java
index ec75b476e4b4..78d1d1ac994d 100644
--- a/maven-core/src/main/java/org/apache/maven/caching/LocalRepositoryImpl.java
+++ b/maven-core/src/main/java/org/apache/maven/caching/LocalRepositoryImpl.java
@@ -31,9 +31,10 @@
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.maven.artifact.Artifact;
-import org.apache.maven.caching.jaxb.ArtifactType;
-import org.apache.maven.caching.jaxb.BuildInfoType;
-import org.apache.maven.caching.jaxb.CacheReportType;
+import org.apache.maven.caching.domain.ArtifactType;
+import org.apache.maven.caching.domain.BuildInfoType;
+import org.apache.maven.caching.domain.CacheReportType;
+import org.apache.maven.caching.domain.Scm;
import org.apache.maven.caching.xml.BuildInfo;
import org.apache.maven.caching.xml.CacheConfig;
import org.apache.maven.caching.xml.CacheSource;
@@ -350,11 +351,11 @@ public FileVisitResult visitFile( Path o, BasicFileAttributes basicFileAttribute
return Optional.of( orderedFiles.get( 0 ).getLeft() );
}
- private String getScmRef( BuildInfoType.Scm scm )
+ private String getScmRef( Scm scm )
{
if ( scm != null )
{
- return scm.isSetSourceBranch() ? scm.getSourceBranch() : scm.getRevision();
+ return scm.getSourceBranch() != null ? scm.getSourceBranch() : scm.getRevision();
}
else
{
diff --git a/maven-core/src/main/java/org/apache/maven/caching/MojoExecutionManager.java b/maven-core/src/main/java/org/apache/maven/caching/MojoExecutionManager.java
index 9c07e5815e69..a6e193695b30 100644
--- a/maven-core/src/main/java/org/apache/maven/caching/MojoExecutionManager.java
+++ b/maven-core/src/main/java/org/apache/maven/caching/MojoExecutionManager.java
@@ -20,8 +20,8 @@
*/
import org.apache.commons.lang3.StringUtils;
-import org.apache.maven.caching.jaxb.CompletedExecutionType;
-import org.apache.maven.caching.jaxb.TrackedPropertyType;
+import org.apache.maven.caching.domain.CompletedExecutionType;
+import org.apache.maven.caching.domain.TrackedPropertyType;
import org.apache.maven.caching.xml.BuildInfo;
import org.apache.maven.caching.xml.CacheConfig;
import org.apache.maven.caching.xml.DtoUtils;
@@ -124,7 +124,7 @@ private boolean isParamsMatched( MavenProject project,
final String propertyName = trackedProperty.getPropertyName();
String expectedValue = DtoUtils.findPropertyValue( propertyName, completedExecution );
- if ( expectedValue == null && trackedProperty.isSetDefaultValue() )
+ if ( expectedValue == null && trackedProperty.getDefaultValue() != null )
{
expectedValue = trackedProperty.getDefaultValue();
}
diff --git a/maven-core/src/main/java/org/apache/maven/caching/PluginScanConfig.java b/maven-core/src/main/java/org/apache/maven/caching/PluginScanConfig.java
index 93bcccba0b1c..a3af7b6cda96 100644
--- a/maven-core/src/main/java/org/apache/maven/caching/PluginScanConfig.java
+++ b/maven-core/src/main/java/org/apache/maven/caching/PluginScanConfig.java
@@ -19,7 +19,7 @@
* under the License.
*/
-import org.apache.maven.caching.jaxb.DirScanConfigType;
+import org.apache.maven.caching.domain.DirScanConfigType;
import javax.annotation.Nonnull;
diff --git a/maven-core/src/main/java/org/apache/maven/caching/PluginScanConfigImpl.java b/maven-core/src/main/java/org/apache/maven/caching/PluginScanConfigImpl.java
index 87791905100d..1c5ea657ed0d 100644
--- a/maven-core/src/main/java/org/apache/maven/caching/PluginScanConfigImpl.java
+++ b/maven-core/src/main/java/org/apache/maven/caching/PluginScanConfigImpl.java
@@ -20,9 +20,9 @@
*/
import org.apache.commons.lang3.StringUtils;
-import org.apache.maven.caching.jaxb.DirScanConfigType;
-import org.apache.maven.caching.jaxb.TagNameType;
-import org.apache.maven.caching.jaxb.TagScanConfigType;
+import org.apache.maven.caching.domain.DirScanConfigType;
+import org.apache.maven.caching.domain.TagNameType;
+import org.apache.maven.caching.domain.TagScanConfigType;
import javax.annotation.Nonnull;
import java.util.List;
@@ -52,13 +52,13 @@ public boolean accept( String tagName )
// include or exclude is a choice element, could be only obe property set
//noinspection ConstantConditions
- final List includes = dto.getInclude();
+ final List includes = dto.getIncludes();
if ( !includes.isEmpty() )
{
return findTagScanProperties( tagName ) != null;
}
- return !contains( dto.getExclude(), tagName );
+ return !contains( dto.getExcludes(), tagName );
}
private boolean contains( List excludes, String tagName )
@@ -95,7 +95,7 @@ public PluginScanConfig mergeWith( final PluginScanConfig overrideConfig )
}
DirScanConfigType merged = new DirScanConfigType();
- if ( override.isSetMode() )
+ if ( override.getMode() != null )
{
merged.setMode( override.getMode() );
}
@@ -104,11 +104,11 @@ public PluginScanConfig mergeWith( final PluginScanConfig overrideConfig )
merged.setMode( dto.getMode() );
}
- merged.getExclude().addAll( dto.getExclude() );
- merged.getExclude().addAll( override.getExclude() );
+ merged.getExcludes().addAll( dto.getExcludes() );
+ merged.getExcludes().addAll( override.getExcludes() );
- merged.getInclude().addAll( dto.getInclude() );
- merged.getInclude().addAll( override.getInclude() );
+ merged.getIncludes().addAll( dto.getIncludes() );
+ merged.getIncludes().addAll( override.getIncludes() );
return new PluginScanConfigImpl( merged );
}
@@ -128,10 +128,10 @@ public DirScanConfigType dto()
private ScanConfigProperties findTagScanProperties( String tagName )
{
- ScanConfigProperties scanConfigProperties = findConfigByName( tagName, dto.getInclude() );
+ ScanConfigProperties scanConfigProperties = findConfigByName( tagName, dto.getIncludes() );
if ( scanConfigProperties == null )
{
- scanConfigProperties = findConfigByName( tagName, dto.getTagScanConfig() );
+ scanConfigProperties = findConfigByName( tagName, dto.getTagScanConfigs() );
}
return scanConfigProperties;
}
diff --git a/maven-core/src/main/java/org/apache/maven/caching/ProjectUtils.java b/maven-core/src/main/java/org/apache/maven/caching/ProjectUtils.java
index 176556850377..dbf9251ea61a 100644
--- a/maven-core/src/main/java/org/apache/maven/caching/ProjectUtils.java
+++ b/maven-core/src/main/java/org/apache/maven/caching/ProjectUtils.java
@@ -25,7 +25,7 @@
import org.apache.commons.lang3.StringUtils;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.handler.ArtifactHandler;
-import org.apache.maven.caching.jaxb.BuildInfoType;
+import org.apache.maven.caching.domain.Scm;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.lifecycle.internal.ProjectIndex;
import org.apache.maven.lifecycle.internal.builder.BuilderCommon;
@@ -155,9 +155,9 @@ public static String getMultimoduleRoot( MavenSession session )
return System.getProperty( "maven.multiModuleProjectDirectory", session.getExecutionRootDirectory() );
}
- public static BuildInfoType.Scm readGitInfo( MavenSession session ) throws IOException
+ public static Scm readGitInfo( MavenSession session ) throws IOException
{
- final BuildInfoType.Scm scmCandidate = new BuildInfoType.Scm();
+ final Scm scmCandidate = new Scm();
final Path gitDir = Paths.get( getMultimoduleRoot( session ), ".git" );
if ( Files.isDirectory( gitDir ) )
{
diff --git a/maven-core/src/main/java/org/apache/maven/caching/RemoteArtifactsRepository.java b/maven-core/src/main/java/org/apache/maven/caching/RemoteArtifactsRepository.java
index 7c118c405739..826faf38ab8a 100644
--- a/maven-core/src/main/java/org/apache/maven/caching/RemoteArtifactsRepository.java
+++ b/maven-core/src/main/java/org/apache/maven/caching/RemoteArtifactsRepository.java
@@ -20,7 +20,7 @@
*/
import com.google.common.base.Optional;
-import org.apache.maven.caching.jaxb.ArtifactType;
+import org.apache.maven.caching.domain.ArtifactType;
import org.apache.maven.caching.xml.BuildInfo;
import org.apache.maven.project.MavenProject;
diff --git a/maven-core/src/main/java/org/apache/maven/caching/checksum/DigestUtils.java b/maven-core/src/main/java/org/apache/maven/caching/checksum/DigestUtils.java
index e837da1f8587..0a156e2296a9 100644
--- a/maven-core/src/main/java/org/apache/maven/caching/checksum/DigestUtils.java
+++ b/maven-core/src/main/java/org/apache/maven/caching/checksum/DigestUtils.java
@@ -22,7 +22,7 @@
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.maven.caching.hash.HashChecksum;
-import org.apache.maven.caching.jaxb.DigestItemType;
+import org.apache.maven.caching.domain.DigestItemType;
import org.mozilla.universalchardet.UniversalDetector;
import java.io.IOException;
diff --git a/maven-core/src/main/java/org/apache/maven/caching/checksum/KeyUtils.java b/maven-core/src/main/java/org/apache/maven/caching/checksum/KeyUtils.java
index 04d9207cb0dc..90da23e90f6d 100644
--- a/maven-core/src/main/java/org/apache/maven/caching/checksum/KeyUtils.java
+++ b/maven-core/src/main/java/org/apache/maven/caching/checksum/KeyUtils.java
@@ -21,7 +21,7 @@
import org.apache.commons.lang3.StringUtils;
import org.apache.maven.artifact.Artifact;
-import org.apache.maven.caching.jaxb.ArtifactType;
+import org.apache.maven.caching.domain.ArtifactType;
import org.apache.maven.model.Dependency;
import org.apache.maven.project.MavenProject;
diff --git a/maven-core/src/main/java/org/apache/maven/caching/checksum/MavenProjectInput.java b/maven-core/src/main/java/org/apache/maven/caching/checksum/MavenProjectInput.java
index 8e5873ce7dcd..56fbaedbdd26 100644
--- a/maven-core/src/main/java/org/apache/maven/caching/checksum/MavenProjectInput.java
+++ b/maven-core/src/main/java/org/apache/maven/caching/checksum/MavenProjectInput.java
@@ -33,11 +33,13 @@
import org.apache.maven.caching.ProjectUtils;
import org.apache.maven.caching.RemoteArtifactsRepository;
import org.apache.maven.caching.ScanConfigProperties;
+import org.apache.maven.caching.domain.Exclude;
import org.apache.maven.caching.hash.HashAlgorithm;
import org.apache.maven.caching.hash.HashChecksum;
import org.apache.maven.caching.hash.HashFactory;
-import org.apache.maven.caching.jaxb.DigestItemType;
-import org.apache.maven.caching.jaxb.ProjectsInputInfoType;
+import org.apache.maven.caching.domain.DigestItemType;
+import org.apache.maven.caching.domain.Include;
+import org.apache.maven.caching.domain.ProjectsInputInfoType;
import org.apache.maven.caching.xml.BuildInfo;
import org.apache.maven.caching.xml.CacheConfig;
import org.apache.maven.caching.xml.DtoUtils;
@@ -94,7 +96,6 @@
import static org.apache.commons.lang3.StringUtils.stripToEmpty;
import static org.apache.maven.caching.ProjectUtils.isBuilding;
import static org.apache.maven.caching.ProjectUtils.isSnapshot;
-import static org.apache.maven.caching.jaxb.PathSetType.Include;
/**
* MavenProjectInput
@@ -179,9 +180,10 @@ public MavenProjectInput( MavenProject project,
filteredOutPaths = new ArrayList<>( Arrays.asList( normalizedPath( build.getDirectory() ), // target by default
normalizedPath( build.getOutputDirectory() ), normalizedPath( build.getTestOutputDirectory() ) ) );
- for ( String excludePath : config.getGlobalExcludePaths() )
+ List excludes = config.getGlobalExcludePaths();
+ for ( Exclude excludePath : excludes )
{
- filteredOutPaths.add( Paths.get( excludePath ) );
+ filteredOutPaths.add( Paths.get( excludePath.getValue() ) );
}
for ( String propertyName : properties.stringPropertyNames() )
diff --git a/maven-core/src/main/java/org/apache/maven/caching/hash/CloseableBuffer.java b/maven-core/src/main/java/org/apache/maven/caching/hash/CloseableBuffer.java
index 0fec3646ffa4..91acdf27b6d3 100644
--- a/maven-core/src/main/java/org/apache/maven/caching/hash/CloseableBuffer.java
+++ b/maven-core/src/main/java/org/apache/maven/caching/hash/CloseableBuffer.java
@@ -35,22 +35,21 @@
*/
public class CloseableBuffer implements AutoCloseable
{
- /* Java 8
- private static final Cleaner CLEANER = doPrivileged((PrivilegedAction) () -> {
- final boolean isOldJava = System.getProperty("java.specification.version", "9").startsWith("1.");
- if (isOldJava) {
- return DirectCleaner.isSupported() ? new DirectCleaner() : new NoopCleaner();
- } else {
- return UnsafeCleaner.isSupported() ? new UnsafeCleaner() : new NoopCleaner();
- }
- });
- */
+
private static final Cleaner CLEANER = doPrivileged( new PrivilegedAction()
{
@Override
public Cleaner run()
{
- return DirectCleaner.isSupported() ? new DirectCleaner() : new NoopCleaner();
+ final String jsv = System.getProperty( "java.specification.version", "9" );
+ if ( jsv.startsWith( "1." ) )
+ {
+ return DirectCleaner.isSupported() ? new DirectCleaner() : new NoopCleaner();
+ }
+ else
+ {
+ return UnsafeCleaner.isSupported() ? new UnsafeCleaner() : new NoopCleaner();
+ }
}
} );
diff --git a/maven-core/src/main/java/org/apache/maven/caching/hash/XXMM.java b/maven-core/src/main/java/org/apache/maven/caching/hash/XXMM.java
index 8e09299c247e..7afe2403ffbe 100644
--- a/maven-core/src/main/java/org/apache/maven/caching/hash/XXMM.java
+++ b/maven-core/src/main/java/org/apache/maven/caching/hash/XXMM.java
@@ -57,8 +57,8 @@ private static class Algorithm extends XX.Algorithm
@Override
public byte[] hash( Path path ) throws IOException
{
- try ( FileChannel channel = FileChannel.open( path,
- READ ); CloseableBuffer buffer = CloseableBuffer.mappedBuffer( channel, READ_ONLY ) )
+ try ( FileChannel channel = FileChannel.open( path, READ );
+ CloseableBuffer buffer = CloseableBuffer.mappedBuffer( channel, READ_ONLY ) )
{
return toByteArray( XX.INSTANCE.hashBytes( buffer.getBuffer() ) );
}
diff --git a/maven-core/src/main/java/org/apache/maven/caching/xml/BuildInfo.java b/maven-core/src/main/java/org/apache/maven/caching/xml/BuildInfo.java
index 0b61bfd89d74..452811e6f79c 100644
--- a/maven-core/src/main/java/org/apache/maven/caching/xml/BuildInfo.java
+++ b/maven-core/src/main/java/org/apache/maven/caching/xml/BuildInfo.java
@@ -24,24 +24,22 @@
import org.apache.maven.caching.ProjectUtils;
import org.apache.maven.caching.checksum.MavenProjectInput;
import org.apache.maven.caching.hash.HashAlgorithm;
-import org.apache.maven.caching.jaxb.ArtifactType;
-import org.apache.maven.caching.jaxb.BuildInfoType;
-import org.apache.maven.caching.jaxb.CompletedExecutionType;
-import org.apache.maven.caching.jaxb.DigestItemType;
-import org.apache.maven.caching.jaxb.ProjectsInputInfoType;
+import org.apache.maven.caching.domain.ArtifactType;
+import org.apache.maven.caching.domain.BuildInfoType;
+import org.apache.maven.caching.domain.CompletedExecutionType;
+import org.apache.maven.caching.domain.DigestItemType;
+import org.apache.maven.caching.domain.ProjectsInputInfoType;
import org.apache.maven.model.Dependency;
import org.apache.maven.plugin.MojoExecution;
import org.codehaus.plexus.logging.Logger;
import org.codehaus.plexus.util.StringUtils;
-import javax.xml.datatype.DatatypeConfigurationException;
-import javax.xml.datatype.DatatypeFactory;
import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Collections;
-import java.util.GregorianCalendar;
+import java.util.Date;
import java.util.List;
import java.util.Objects;
@@ -66,13 +64,7 @@ public BuildInfo( List goals,
{
this.dto = new BuildInfoType();
this.dto.setCacheImplementationVersion( MavenProjectInput.CACHE_IMPLMENTATION_VERSION );
- try
- {
- this.dto.setBuildTime( DatatypeFactory.newInstance().newXMLGregorianCalendar( new GregorianCalendar() ) );
- }
- catch ( DatatypeConfigurationException ignore )
- {
- }
+ this.dto.setBuildTime( new Date() );
try
{
this.dto.setBuildServer( InetAddress.getLocalHost().getCanonicalHostName() );
@@ -83,10 +75,9 @@ public BuildInfo( List goals,
}
this.dto.setHashFunction( hashAlgorithm );
this.dto.setArtifact( artifact );
- this.dto.setGoals( createGoals( goals ) );
- this.dto.setAttachedArtifacts( new BuildInfoType.AttachedArtifacts() );
- this.dto.getAttachedArtifacts().getArtifact().addAll( attachedArtifacts );
- this.dto.setExecutions( createExecutions( completedExecutions ) );
+ this.dto.setGoals( goals );
+ this.dto.setAttachedArtifacts( attachedArtifacts );
+ this.dto.setExecutions( completedExecutions );
this.dto.setProjectsInputInfo( projectsInputInfo );
this.source = CacheSource.BUILD;
}
@@ -96,30 +87,16 @@ public CacheSource getSource()
return source;
}
- private BuildInfoType.Executions createExecutions( List completedExecutions )
- {
- BuildInfoType.Executions executions = new BuildInfoType.Executions();
- executions.getExecution().addAll( completedExecutions );
- return executions;
- }
-
public BuildInfo( BuildInfoType buildInfo, CacheSource source )
{
this.dto = buildInfo;
this.source = source;
}
- public static BuildInfoType.Goals createGoals( List list )
- {
- BuildInfoType.Goals goals = new BuildInfoType.Goals();
- goals.getGoal().addAll( list );
- return goals;
- }
-
- public static BuildInfoType.AttachedArtifacts createAttachedArtifacts( List artifacts,
- HashAlgorithm algorithm ) throws IOException
+ public static List createAttachedArtifacts( List artifacts,
+ HashAlgorithm algorithm ) throws IOException
{
- BuildInfoType.AttachedArtifacts attachedArtifacts = new BuildInfoType.AttachedArtifacts();
+ List attachedArtifacts = new ArrayList<>();
for ( Artifact artifact : artifacts )
{
final ArtifactType dto = DtoUtils.createDto( artifact );
@@ -127,7 +104,7 @@ public static BuildInfoType.AttachedArtifacts createAttachedArtifacts( List mojos, Logger logger
private boolean hasCompletedExecution( String mojoExecutionKey )
{
- final List completedExecutions = dto.getExecutions().getExecution();
- for ( CompletedExecutionType completedExecution : completedExecutions )
+ final List completedExecutions = dto.getExecutions();
+ if ( dto.getExecutions() != null )
{
- if ( StringUtils.equals( completedExecution.getExecutionKey(), mojoExecutionKey ) )
+ for ( CompletedExecutionType completedExecution : completedExecutions )
{
- return true;
+ if ( StringUtils.equals( completedExecution.getExecutionKey(), mojoExecutionKey ) )
+ {
+ return true;
+ }
}
}
return false;
@@ -168,12 +148,12 @@ public String toString()
public CompletedExecutionType findMojoExecutionInfo( MojoExecution mojoExecution )
{
- if ( !dto.isSetExecutions() )
+ if ( dto.getExecutions() == null )
{
return null;
}
- final List executions = dto.getExecutions().getExecution();
+ final List executions = dto.getExecutions();
for ( CompletedExecutionType execution : executions )
{
if ( StringUtils.equals( execution.getExecutionKey(), mojoExecutionKey( mojoExecution ) ) )
@@ -196,9 +176,9 @@ public ArtifactType getArtifact()
public List getAttachedArtifacts()
{
- if ( dto.isSetAttachedArtifacts() )
+ if ( dto.getAttachedArtifacts() != null )
{
- return dto.getAttachedArtifacts().getArtifact();
+ return dto.getAttachedArtifacts();
}
return Collections.emptyList();
}
@@ -210,7 +190,7 @@ public BuildInfoType getDto()
public String getHighestCompletedGoal()
{
- return Iterables.getLast( dto.getGoals().getGoal() );
+ return Iterables.getLast( dto.getGoals() );
}
public List getCachedSegment( List mojoExecutions )
diff --git a/maven-core/src/main/java/org/apache/maven/caching/xml/CacheConfig.java b/maven-core/src/main/java/org/apache/maven/caching/xml/CacheConfig.java
index 2f5137d9a3ea..a9dd950652eb 100644
--- a/maven-core/src/main/java/org/apache/maven/caching/xml/CacheConfig.java
+++ b/maven-core/src/main/java/org/apache/maven/caching/xml/CacheConfig.java
@@ -21,10 +21,11 @@
import org.apache.maven.caching.PluginScanConfig;
import org.apache.maven.caching.checksum.MultimoduleDiscoveryStrategy;
+import org.apache.maven.caching.domain.Exclude;
import org.apache.maven.caching.hash.HashFactory;
-import org.apache.maven.caching.jaxb.PathSetType;
-import org.apache.maven.caching.jaxb.PropertyNameType;
-import org.apache.maven.caching.jaxb.TrackedPropertyType;
+import org.apache.maven.caching.domain.Include;
+import org.apache.maven.caching.domain.PropertyNameType;
+import org.apache.maven.caching.domain.TrackedPropertyType;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.model.Plugin;
import org.apache.maven.model.PluginExecution;
@@ -62,10 +63,10 @@ public interface CacheConfig
String getDefaultGlob();
@Nonnull
- List getGlobalIncludePaths();
+ List getGlobalIncludePaths();
@Nonnull
- List getGlobalExcludePaths();
+ List getGlobalExcludePaths();
@Nonnull
PluginScanConfig getPluginDirScanConfig( Plugin plugin );
diff --git a/maven-core/src/main/java/org/apache/maven/caching/xml/CacheConfigImpl.java b/maven-core/src/main/java/org/apache/maven/caching/xml/CacheConfigImpl.java
index 9dd0e85f578f..df8eb26003fe 100644
--- a/maven-core/src/main/java/org/apache/maven/caching/xml/CacheConfigImpl.java
+++ b/maven-core/src/main/java/org/apache/maven/caching/xml/CacheConfigImpl.java
@@ -26,21 +26,26 @@
import org.apache.maven.caching.PluginScanConfig;
import org.apache.maven.caching.PluginScanConfigImpl;
import org.apache.maven.caching.checksum.MultimoduleDiscoveryStrategy;
+import org.apache.maven.caching.domain.AttachedOutputs;
+import org.apache.maven.caching.domain.Exclude;
+import org.apache.maven.caching.domain.Include;
+import org.apache.maven.caching.domain.Local;
+import org.apache.maven.caching.domain.ProjectDiscoveryStrategy;
+import org.apache.maven.caching.domain.Remote;
import org.apache.maven.caching.hash.HashFactory;
-import org.apache.maven.caching.jaxb.CacheType;
-import org.apache.maven.caching.jaxb.ConfigurationType;
-import org.apache.maven.caching.jaxb.CoordinatesBaseType;
-import org.apache.maven.caching.jaxb.ExecutablesType;
-import org.apache.maven.caching.jaxb.ExecutionConfigurationScanType;
-import org.apache.maven.caching.jaxb.ExecutionControlType;
-import org.apache.maven.caching.jaxb.ExecutionIdsListType;
-import org.apache.maven.caching.jaxb.GoalReconciliationType;
-import org.apache.maven.caching.jaxb.GoalsListType;
-import org.apache.maven.caching.jaxb.PathSetType;
-import org.apache.maven.caching.jaxb.PluginConfigurationScanType;
-import org.apache.maven.caching.jaxb.PluginSetType;
-import org.apache.maven.caching.jaxb.PropertyNameType;
-import org.apache.maven.caching.jaxb.TrackedPropertyType;
+import org.apache.maven.caching.domain.CacheType;
+import org.apache.maven.caching.domain.ConfigurationType;
+import org.apache.maven.caching.domain.CoordinatesBaseType;
+import org.apache.maven.caching.domain.ExecutablesType;
+import org.apache.maven.caching.domain.ExecutionConfigurationScanType;
+import org.apache.maven.caching.domain.ExecutionControlType;
+import org.apache.maven.caching.domain.ExecutionIdsListType;
+import org.apache.maven.caching.domain.GoalReconciliationType;
+import org.apache.maven.caching.domain.GoalsListType;
+import org.apache.maven.caching.domain.PluginConfigurationScanType;
+import org.apache.maven.caching.domain.PluginSetType;
+import org.apache.maven.caching.domain.PropertyNameType;
+import org.apache.maven.caching.domain.TrackedPropertyType;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.model.Plugin;
import org.apache.maven.model.PluginExecution;
@@ -186,7 +191,7 @@ public List getTrackedProperties( MojoExecution mojoExecuti
final GoalReconciliationType reconciliationConfig = findReconciliationConfig( mojoExecution );
if ( reconciliationConfig != null )
{
- return reconciliationConfig.getReconcile();
+ return reconciliationConfig.getReconciles();
}
else
{
@@ -202,25 +207,25 @@ public boolean isLogAllProperties( MojoExecution mojoExecution )
{
return true;
}
- return cacheConfig.isSetExecutionControl() && cacheConfig.getExecutionControl().isSetReconcile()
+ return cacheConfig.getExecutionControl() != null && cacheConfig.getExecutionControl().getReconcile() != null
&& cacheConfig.getExecutionControl().getReconcile().isLogAllProperties();
}
private GoalReconciliationType findReconciliationConfig( MojoExecution mojoExecution )
{
- if ( !cacheConfig.isSetExecutionControl() )
+ if ( cacheConfig.getExecutionControl() == null )
{
return null;
}
final ExecutionControlType executionControl = cacheConfig.getExecutionControl();
- if ( !executionControl.isSetReconcile() )
+ if ( executionControl.getReconcile() == null )
{
return null;
}
- final List reconciliation = executionControl.getReconcile().getPlugin();
+ final List reconciliation = executionControl.getReconcile().getPlugins();
for ( GoalReconciliationType goalReconciliationConfig : reconciliation )
{
@@ -245,7 +250,7 @@ public List getLoggedProperties( MojoExecution mojoExecution )
final GoalReconciliationType reconciliationConfig = findReconciliationConfig( mojoExecution );
if ( reconciliationConfig != null )
{
- return reconciliationConfig.getLog();
+ return reconciliationConfig.getLogs();
}
else
{
@@ -261,7 +266,7 @@ public List getNologProperties( MojoExecution mojoExecution )
final GoalReconciliationType reconciliationConfig = findReconciliationConfig( mojoExecution );
if ( reconciliationConfig != null )
{
- return reconciliationConfig.getNolog();
+ return reconciliationConfig.getNologs();
}
else
{
@@ -276,9 +281,9 @@ public List getEffectivePomExcludeProperties( Plugin plugin )
checkInitializedState();
final PluginConfigurationScanType pluginConfig = findPluginScanConfig( plugin );
- if ( pluginConfig != null && pluginConfig.isSetEffectivePom() )
+ if ( pluginConfig != null && pluginConfig.getEffectivePom() != null )
{
- return pluginConfig.getEffectivePom().getExcludeProperty();
+ return pluginConfig.getEffectivePom().getExcludeProperties();
}
return Collections.emptyList();
}
@@ -286,12 +291,12 @@ public List getEffectivePomExcludeProperties( Plugin plugin )
private PluginConfigurationScanType findPluginScanConfig( Plugin plugin )
{
- if ( !cacheConfig.isSetInput() )
+ if ( cacheConfig.getInput() == null )
{
return null;
}
- final List pluginConfigs = cacheConfig.getInput().getPlugin();
+ final List pluginConfigs = cacheConfig.getInput().getPlugins();
for ( PluginConfigurationScanType pluginConfig : pluginConfigs )
{
if ( isPluginMatch( plugin, pluginConfig ) )
@@ -305,7 +310,7 @@ private PluginConfigurationScanType findPluginScanConfig( Plugin plugin )
private boolean isPluginMatch( Plugin plugin, CoordinatesBaseType pluginConfig )
{
return StringUtils.equals( pluginConfig.getArtifactId(),
- plugin.getArtifactId() ) && ( !pluginConfig.isSetGroupId() || StringUtils.equals(
+ plugin.getArtifactId() ) && ( pluginConfig.getGroupId() == null || StringUtils.equals(
pluginConfig.getGroupId(), plugin.getGroupId() ) );
}
@@ -316,7 +321,7 @@ public PluginScanConfig getPluginDirScanConfig( Plugin plugin )
{
checkInitializedState();
final PluginConfigurationScanType pluginConfig = findPluginScanConfig( plugin );
- if ( pluginConfig == null || !pluginConfig.isSetDirScan() )
+ if ( pluginConfig == null || pluginConfig.getDirScan() == null )
{
return new DefaultPluginScanConfig();
}
@@ -334,8 +339,8 @@ public PluginScanConfig getExecutionDirScanConfig( Plugin plugin, PluginExecutio
if ( pluginScanConfig != null )
{
final ExecutionConfigurationScanType executionScanConfig = findExecutionScanConfig( exec,
- pluginScanConfig.getExecution() );
- if ( executionScanConfig != null && executionScanConfig.isSetDirScan() )
+ pluginScanConfig.getExecutions() );
+ if ( executionScanConfig != null && executionScanConfig.getDirScan() != null )
{
return new PluginScanConfigImpl( executionScanConfig.getDirScan() );
}
@@ -349,7 +354,7 @@ private ExecutionConfigurationScanType findExecutionScanConfig( PluginExecution
{
for ( ExecutionConfigurationScanType executionScanConfig : scanConfigs )
{
- if ( executionScanConfig.getExecId().contains( execution.getId() ) )
+ if ( executionScanConfig.getExecIds().contains( execution.getId() ) )
{
return executionScanConfig;
}
@@ -373,18 +378,18 @@ public String getDefaultGlob()
@Nonnull
@Override
- public List getGlobalIncludePaths()
+ public List getGlobalIncludePaths()
{
checkInitializedState();
- return cacheConfig.getInput().getGlobal().getInclude();
+ return cacheConfig.getInput().getGlobal().getIncludes();
}
@Nonnull
@Override
- public List getGlobalExcludePaths()
+ public List getGlobalExcludePaths()
{
checkInitializedState();
- return cacheConfig.getInput().getGlobal().getExclude();
+ return cacheConfig.getInput().getGlobal().getExcludes();
}
@Nonnull
@@ -392,9 +397,9 @@ public List getGlobalExcludePaths()
public MultimoduleDiscoveryStrategy getMultimoduleDiscoveryStrategy()
{
checkInitializedState();
- final ConfigurationType.ProjectDiscoveryStrategy projectDiscoveryStrategy =
+ final ProjectDiscoveryStrategy projectDiscoveryStrategy =
cacheConfig.getConfiguration().getProjectDiscoveryStrategy();
- if ( projectDiscoveryStrategy.isSetSpecificVersion() )
+ if ( projectDiscoveryStrategy != null && projectDiscoveryStrategy.getSpecificVersion() != null )
{
return new SentinelVersionStartegy( projectDiscoveryStrategy.getSpecificVersion() );
}
@@ -413,7 +418,7 @@ public HashFactory getHashFactory()
public boolean canIgnore( MojoExecution mojoExecution )
{
checkInitializedState();
- if ( !cacheConfig.isSetExecutionControl() || !cacheConfig.getExecutionControl().isSetIgnoreMissing() )
+ if ( cacheConfig.getExecutionControl() == null || cacheConfig.getExecutionControl().getIgnoreMissing() == null )
{
return false;
}
@@ -425,7 +430,7 @@ public boolean canIgnore( MojoExecution mojoExecution )
public boolean isForcedExecution( MojoExecution execution )
{
checkInitializedState();
- if ( !cacheConfig.isSetExecutionControl() || !cacheConfig.getExecutionControl().isSetRunAlways() )
+ if ( cacheConfig.getExecutionControl() == null || cacheConfig.getExecutionControl().getRunAlways() == null )
{
return false;
}
@@ -435,7 +440,7 @@ public boolean isForcedExecution( MojoExecution execution )
private boolean executionMatches( MojoExecution execution, ExecutablesType executablesType )
{
- final List pluginConfigs = executablesType.getPlugin();
+ final List pluginConfigs = executablesType.getPlugins();
for ( PluginSetType pluginConfig : pluginConfigs )
{
if ( isPluginMatch( execution.getPlugin(), pluginConfig ) )
@@ -444,20 +449,20 @@ private boolean executionMatches( MojoExecution execution, ExecutablesType execu
}
}
- final List executionIds = executablesType.getExecution();
+ final List executionIds = executablesType.getExecutions();
for ( ExecutionIdsListType executionConfig : executionIds )
{
- if ( isPluginMatch( execution.getPlugin(), executionConfig ) && executionConfig.getExecId().contains(
+ if ( isPluginMatch( execution.getPlugin(), executionConfig ) && executionConfig.getExecIds().contains(
execution.getExecutionId() ) )
{
return true;
}
}
- final List pluginsGoalsList = executablesType.getGoals();
+ final List pluginsGoalsList = executablesType.getGoalsLists();
for ( GoalsListType pluginGoals : pluginsGoalsList )
{
- if ( isPluginMatch( execution.getPlugin(), pluginGoals ) && pluginGoals.getGoal().contains(
+ if ( isPluginMatch( execution.getPlugin(), pluginGoals ) && pluginGoals.getGoals().contains(
execution.getGoal() ) )
{
return true;
@@ -524,15 +529,15 @@ public String getUrl()
public int getMaxLocalBuildsCached()
{
checkInitializedState();
- return getLocal().getMaxBuildsCached().intValue();
+ return getLocal().getMaxBuildsCached();
}
@Override
public List getAttachedOutputs()
{
checkInitializedState();
- final ConfigurationType.AttachedOutputs attachedOutputs = getConfiguration().getAttachedOutputs();
- return attachedOutputs == null ? Collections.emptyList() : attachedOutputs.getDirName();
+ final AttachedOutputs attachedOutputs = getConfiguration().getAttachedOutputs();
+ return attachedOutputs == null ? Collections.emptyList() : attachedOutputs.getDirNames();
}
@Nonnull
@@ -545,10 +550,10 @@ public List getExcludePatterns()
private List compileExcludePatterns()
{
- if ( cacheConfig.isSetOutput() && cacheConfig.getOutput().isSetExclude() )
+ if ( cacheConfig.getOutput() != null && cacheConfig.getOutput().getExclude() != null )
{
List patterns = new ArrayList<>();
- for ( String pattern : cacheConfig.getOutput().getExclude().getPattern() )
+ for ( String pattern : cacheConfig.getOutput().getExclude().getPatterns() )
{
patterns.add( Pattern.compile( pattern ) );
}
@@ -557,12 +562,12 @@ private List compileExcludePatterns()
return Collections.emptyList();
}
- private ConfigurationType.Remote getRemote()
+ private Remote getRemote()
{
return getConfiguration().getRemote();
}
- private ConfigurationType.Local getLocal()
+ private Local getLocal()
{
return getConfiguration().getLocal();
}
diff --git a/maven-core/src/main/java/org/apache/maven/caching/xml/DtoUtils.java b/maven-core/src/main/java/org/apache/maven/caching/xml/DtoUtils.java
index a2810ab86824..7bd2d2b2dc2f 100644
--- a/maven-core/src/main/java/org/apache/maven/caching/xml/DtoUtils.java
+++ b/maven-core/src/main/java/org/apache/maven/caching/xml/DtoUtils.java
@@ -23,14 +23,16 @@
import org.apache.commons.lang3.StringUtils;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.caching.ProjectUtils;
-import org.apache.maven.caching.jaxb.ArtifactType;
-import org.apache.maven.caching.jaxb.CompletedExecutionType;
-import org.apache.maven.caching.jaxb.DigestItemType;
-import org.apache.maven.caching.jaxb.PropertyValueType;
-import org.apache.maven.caching.jaxb.TrackedPropertyType;
+import org.apache.maven.caching.domain.ArtifactType;
+import org.apache.maven.caching.domain.CompletedExecutionType;
+import org.apache.maven.caching.domain.DigestItemType;
+import org.apache.maven.caching.domain.PropertyValueType;
+import org.apache.maven.caching.domain.TrackedPropertyType;
import org.apache.maven.model.Dependency;
import javax.annotation.Nonnull;
+
+import java.util.ArrayList;
import java.util.List;
import static org.apache.maven.caching.checksum.KeyUtils.getArtifactKey;
@@ -43,12 +45,12 @@ public class DtoUtils
public static String findPropertyValue( String propertyName, CompletedExecutionType completedExecution )
{
- final CompletedExecutionType.Configuration configuration = completedExecution.getConfiguration();
+ final List configuration = completedExecution.getConfiguration();
if ( configuration == null )
{
return null;
}
- final List properties = configuration.getProperty();
+ final List properties = configuration;
for ( PropertyValueType property : properties )
{
if ( StringUtils.equals( propertyName, property.getName() ) )
@@ -124,7 +126,7 @@ public static void addProperty( CompletedExecutionType execution,
{
if ( execution.getConfiguration() == null )
{
- execution.setConfiguration( new CompletedExecutionType.Configuration() );
+ execution.setConfiguration( new ArrayList<>() );
}
final PropertyValueType valueType = new PropertyValueType();
valueType.setName( propertyName );
@@ -135,7 +137,7 @@ public static void addProperty( CompletedExecutionType execution,
final String valueText = String.valueOf( value );
valueType.setValue( StringUtils.remove( valueText, baseDirPath ) );
valueType.setTracked( tracked );
- execution.getConfiguration().getProperty().add( valueType );
+ execution.getConfiguration().add( valueType );
}
public static boolean containsAllProperties(
@@ -147,12 +149,12 @@ public static boolean containsAllProperties(
return true;
}
- if ( !cachedExecution.isSetConfiguration() )
+ if ( cachedExecution.getConfiguration() == null )
{
return false;
}
- final List executionProperties = cachedExecution.getConfiguration().getProperty();
+ final List executionProperties = cachedExecution.getConfiguration();
for ( TrackedPropertyType trackedProperty : trackedProperties )
{
if ( !contains( executionProperties, trackedProperty.getPropertyName() ) )
@@ -178,42 +180,15 @@ public static boolean contains( List executionProperties, Str
public static ArtifactType copy( ArtifactType artifact )
{
ArtifactType copy = new ArtifactType();
- if ( artifact.isSetArtifactId() )
- {
- copy.setArtifactId( artifact.getArtifactId() );
- }
- if ( artifact.isSetGroupId() )
- {
- copy.setGroupId( artifact.getGroupId() );
- }
- if ( artifact.isSetVersion() )
- {
- copy.setVersion( artifact.getVersion() );
- }
- if ( artifact.isSetType() )
- {
- copy.setType( artifact.getType() );
- }
- if ( artifact.isSetClassifier() )
- {
- copy.setClassifier( artifact.getClassifier() );
- }
- if ( artifact.isSetScope() )
- {
- copy.setScope( artifact.getScope() );
- }
- if ( artifact.isSetFileName() )
- {
- copy.setFileName( artifact.getFileName() );
- }
- if ( artifact.isSetFileHash() )
- {
- copy.setFileHash( artifact.getFileHash() );
- }
- if ( artifact.isSetFileSize() )
- {
- copy.setFileSize( artifact.getFileSize() );
- }
+ copy.setArtifactId( artifact.getArtifactId() );
+ copy.setGroupId( artifact.getGroupId() );
+ copy.setVersion( artifact.getVersion() );
+ copy.setType( artifact.getType() );
+ copy.setClassifier( artifact.getClassifier() );
+ copy.setScope( artifact.getScope() );
+ copy.setFileName( artifact.getFileName() );
+ copy.setFileHash( artifact.getFileHash() );
+ copy.setFileSize( artifact.getFileSize() );
return copy;
}
}
diff --git a/maven-core/src/main/java/org/apache/maven/caching/xml/XmlService.java b/maven-core/src/main/java/org/apache/maven/caching/xml/XmlService.java
index 658c9d0dd3b1..6419c8f6ed75 100644
--- a/maven-core/src/main/java/org/apache/maven/caching/xml/XmlService.java
+++ b/maven-core/src/main/java/org/apache/maven/caching/xml/XmlService.java
@@ -19,27 +19,27 @@
* under the License.
*/
-import org.apache.maven.caching.jaxb.BuildDiffType;
-import org.apache.maven.caching.jaxb.BuildInfoType;
-import org.apache.maven.caching.jaxb.CacheReportType;
-import org.apache.maven.caching.jaxb.ObjectFactory;
+import org.apache.maven.caching.domain.CacheType;
+import org.apache.maven.caching.domain.io.xpp3.CacheConfigXpp3Reader;
+import org.apache.maven.caching.domain.io.xpp3.CacheConfigXpp3Writer;
+import org.apache.maven.caching.domain.io.xpp3.CacheDiffXpp3Reader;
+import org.apache.maven.caching.domain.io.xpp3.CacheDiffXpp3Writer;
+import org.apache.maven.caching.domain.io.xpp3.CacheDomainXpp3Reader;
+import org.apache.maven.caching.domain.BuildDiffType;
+import org.apache.maven.caching.domain.BuildInfoType;
+import org.apache.maven.caching.domain.CacheReportType;
+import org.apache.maven.caching.domain.io.xpp3.CacheDomainXpp3Writer;
+import org.apache.maven.caching.domain.io.xpp3.CacheReportXpp3Reader;
+import org.apache.maven.caching.domain.io.xpp3.CacheReportXpp3Writer;
import org.codehaus.plexus.component.annotations.Component;
-import org.xml.sax.SAXException;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
-import javax.xml.XMLConstants;
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBElement;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Marshaller;
-import javax.xml.bind.Unmarshaller;
-import javax.xml.transform.Source;
-import javax.xml.transform.stream.StreamSource;
-import javax.xml.validation.Schema;
-import javax.xml.validation.SchemaFactory;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
+import java.io.IOException;
import java.io.InputStream;
+import java.nio.file.Files;
/**
* XmlService
@@ -48,98 +48,80 @@
public class XmlService
{
- private final ObjectFactory objectFactory;
- private final JAXBContext jaxbContext;
- private final Schema schema;
-
- public XmlService() throws JAXBException, SAXException
- {
- objectFactory = new ObjectFactory();
- jaxbContext = JAXBContext.newInstance( "org.apache.maven.caching.jaxb", XmlService.class.getClassLoader() );
-
- SchemaFactory sf = SchemaFactory.newInstance( XMLConstants.W3C_XML_SCHEMA_NS_URI );
- final InputStream domainSchemaStream = getResourceAsStream( "cache-domain.xsd" );
- final Source domainSchema = new StreamSource( domainSchemaStream );
- final InputStream configSchemaStream = getResourceAsStream( "cache-config.xsd" );
- final Source configSchema = new StreamSource( configSchemaStream );
- schema = sf.newSchema( new Source[] {domainSchema, configSchema} );
- }
-
- public byte[] toBytes( BuildInfoType buildInfo )
- {
- return serializeXml( objectFactory.createBuild( buildInfo ) );
- }
-
- public byte[] toBytes( BuildDiffType diff )
+ public byte[] toBytes( CacheType cache ) throws IOException
{
- return serializeXml( objectFactory.createDiff( diff ) );
+ try ( ByteArrayOutputStream baos = new ByteArrayOutputStream() )
+ {
+ new CacheConfigXpp3Writer().write( baos, cache );
+ return baos.toByteArray();
+ }
}
- public byte[] toBytes( CacheReportType cacheReportType )
+ public byte[] toBytes( BuildInfoType buildInfo ) throws IOException
{
-
- return serializeXml( objectFactory.createReport( cacheReportType ) );
+ try ( ByteArrayOutputStream baos = new ByteArrayOutputStream() )
+ {
+ new CacheDomainXpp3Writer().write( baos, buildInfo );
+ return baos.toByteArray();
+ }
}
- private byte[] serializeXml( JAXBElement> element )
+ public byte[] toBytes( BuildDiffType diff ) throws IOException
{
- try
+ try ( ByteArrayOutputStream baos = new ByteArrayOutputStream() )
{
- Marshaller jaxbMarshaller = jaxbContext.createMarshaller();
- jaxbMarshaller.setSchema( schema );
- // output pretty printed
- jaxbMarshaller.setProperty( Marshaller.JAXB_FORMATTED_OUTPUT, true );
- jaxbMarshaller.setProperty( Marshaller.JAXB_ENCODING, "UTF-8" );
- final ByteArrayOutputStream baos = new ByteArrayOutputStream();
- jaxbMarshaller.marshal( element, baos );
+ new CacheDiffXpp3Writer().write( baos, diff );
return baos.toByteArray();
}
- catch ( Exception e )
- {
- throw new RuntimeException( "Errors in jaxb serialization: " + e.toString(), e );
- }
}
- public T fromFile( Class clazz, File file )
+ public byte[] toBytes( CacheReportType cacheReportType ) throws IOException
{
-
- try
- {
- Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
- unmarshaller.setSchema( schema );
- JAXBElement result = (JAXBElement) unmarshaller.unmarshal( file );
- return result.getValue();
- }
- catch ( Exception e )
+ try ( ByteArrayOutputStream baos = new ByteArrayOutputStream() )
{
- throw new RuntimeException( "Errors in jaxb serialization: " + e.toString(), e );
+ new CacheReportXpp3Writer().write( baos, cacheReportType );
+ return baos.toByteArray();
}
}
- public static InputStream getResourceAsStream( String name )
+ public T fromFile( Class clazz, File file ) throws IOException, XmlPullParserException
{
- ClassLoader cl = XmlService.class.getClassLoader();
- if ( cl == null )
- {
- // A system class.
- return ClassLoader.getSystemResourceAsStream( name );
- }
- return cl.getResourceAsStream( name );
+ return fromInputStream( clazz, Files.newInputStream( file.toPath() ) );
}
public T fromBytes( Class clazz, byte[] bytes )
+ {
+ return fromInputStream( clazz, new ByteArrayInputStream( bytes ) );
+ }
+
+ public T fromInputStream( Class clazz, InputStream inputStream )
{
try
{
- Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
- unmarshaller.setSchema( schema );
- JAXBElement result = (JAXBElement) unmarshaller.unmarshal( new ByteArrayInputStream( bytes ) );
- return result.getValue();
-
+ if ( clazz == BuildInfoType.class )
+ {
+ return clazz.cast( new CacheDomainXpp3Reader().read( inputStream ) );
+ }
+ else if ( clazz == CacheType.class )
+ {
+ return clazz.cast( new CacheConfigXpp3Reader().read( inputStream ) );
+ }
+ else if ( clazz == BuildDiffType.class )
+ {
+ return clazz.cast( new CacheDiffXpp3Reader().read( inputStream ) );
+ }
+ else if ( clazz == CacheReportType.class )
+ {
+ return clazz.cast( new CacheReportXpp3Reader().read( inputStream ) );
+ }
+ else
+ {
+ throw new IllegalArgumentException( "Unsupported type " + clazz );
+ }
}
- catch ( Exception e )
+ catch ( IOException | XmlPullParserException e )
{
- throw new RuntimeException( "Errors in jaxb serialization: " + e.toString(), e );
+ throw new RuntimeException( "Unable to parse cache xml element", e );
}
}
}
diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecycleExecutionPlanCalculator.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecycleExecutionPlanCalculator.java
index ef60c4eb36b0..9992cf368c85 100644
--- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecycleExecutionPlanCalculator.java
+++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecycleExecutionPlanCalculator.java
@@ -554,6 +554,8 @@ private List calculateForkedGoal( MojoExecution mojoExecution, Ma
MojoExecution forkedExecution = new MojoExecution( forkedMojoDescriptor, forkedGoal );
+ forkedExecution.setLifecyclePhase( mojoExecution.getLifecyclePhase() );
+
mojoExecutionConfigurator( forkedExecution ).configure( project, forkedExecution, true );
finalizeMojoConfiguration( forkedExecution );
diff --git a/maven-core/src/main/mdo/cache-config.mdo b/maven-core/src/main/mdo/cache-config.mdo
new file mode 100644
index 000000000000..5160bb88a6db
--- /dev/null
+++ b/maven-core/src/main/mdo/cache-config.mdo
@@ -0,0 +1,1399 @@
+
+
+
+ cache-config
+ CacheConfig
+
+
+
+
+ package
+ org.apache.maven.caching.domain
+
+
+
+
+
+
+
+ CacheType
+
+
+ configuration
+
+ ConfigurationType
+
+
+
+ input
+
+ InputType
+
+
+
+ output
+
+ OutputType
+
+
+
+ executionControl
+
+ ExecutionControlType
+
+
+
+
+
+
+
+ Remote
+
+
+ url
+ String
+ address of remote cache
+
+
+ enabled
+ boolean
+ true
+
+
+ saveToRemote
+ boolean
+ false
+ Save output to remote cache. Recommended to enable on CI agents only.
+
+
+
+
+
+
+ ConfigurationType
+
+
+ enabled
+ boolean
+
+
+ hashAlgorithm
+ String
+ One of XX, XXMM, SHA-1, SHA-256, SHA-384, SHA-512
+
+
+ validateXml
+ boolean
+ true
+ Validate cache config and builds metadata against xsd.
+
+
+ projectDiscoveryStrategy
+
+ ProjectDiscoveryStrategy
+
+ Specifies how to identify belonging to a cached project then submodule is being build.
+
+
+ remote
+
+ Remote
+
+
+
+ attachedOutputs
+
+ AttachedOutputs
+
+
+
+ local
+
+ Local
+
+
+
+ debugs
+
+ String
+ *
+
+ FileHash (causes file hash is saved in build metadata) or
+ EffectivePom (causes effective pom info is saved in build metadata)
+
+
+
+
+
+
+ ProjectDiscoveryStrategy
+
+
+ specificVersion
+ String
+
+ Any project dependency this this version will be considered cache eligible and will
+ be processed cache aware
+
+
+
+
+
+
+
+ AttachedOutputs
+
+
+ dirNames
+
+ String
+ *
+
+ Directory name in build output directory to attach to cached artifacts
+
+
+
+
+
+
+ Local
+
+
+ maxBuildsCached
+ int
+ 3
+ Maximum number of cached build per artifact in local cache. First created cache (the
+ oldest) is evicted if breached.
+
+
+
+
+
+
+ InputType
+
+
+ global
+
+ PathSetType
+
+ Global input calculation rules applicable to all projects and plugins in the build
+
+
+ plugins
+
+ PluginConfigurationScanType
+ *
+
+ Plugin specific input calculation rules
+
+
+
+
+
+
+ PluginConfigurationScanType
+ CoordinatesBaseType
+
+
+ effectivePom
+
+ EffectivePom
+
+ Effective pom calculation rules
+
+
+ dirScan
+
+ DirScanConfigType
+
+ Specifies plugin level rules of configuration processing in search of referenced source files
+
+
+ executions
+
+ ExecutionConfigurationScanType
+ *
+
+ Specifies execution specific configuration processing in search of referenced source files
+
+
+
+
+
+
+ EffectivePom
+
+
+ excludeProperties
+
+ String
+ *
+
+ Plugin configuration property should be excluded from effective pom calculation
+
+
+
+
+
+
+ ExecutionConfigurationScanType
+
+
+ execIds
+
+ String
+ *
+
+
+
+ dirScan
+
+ DirScanConfigType
+
+ Specifies rules of configuration processing in search of referenced source files
+
+
+ ignoreParentConfig
+ boolean
+ ignore parent config or inherit/merge
+
+
+
+
+
+
+ TagScanConfigType
+ TagNameType
+
+
+ recursive
+ boolean
+ true
+
+
+ glob
+ String
+ *
+
+
+
+
+
+
+ DirScanConfigType
+
+
+ includes
+
+ TagScanConfigType
+ *
+
+ Forces cache to treat property value as input and include in calculation. If set, only included
+ properties will be takein in calculation (whitelist)
+
+
+ excludes
+
+ TagNameType
+ *
+
+ Tag to exclude when scanning plugin configuration for input files (blacklist)
+
+
+ tagScanConfigs
+
+ TagScanConfigType
+ *
+
+ Additional processing rules for non-blacklisted tags
+
+
+ ignoreParent
+ boolean
+ false
+ Ignore parent settings or inherit and merge
+
+
+ mode
+ String
+
+ Either 'auto' (scan directory accordingly to cache implementation) or 'skip' (skip directory).
+
+
+
+
+
+
+
+ OutputType
+
+
+ exclude
+
+ OutputTypeExclude
+
+ Patterns to exclude output artifacts applicable to all projects in the build
+
+
+
+
+
+ OutputTypeExclude
+
+
+ patterns
+
+ String
+ *
+
+
+
+
+
+
+
+ PathSetType
+
+
+ glob
+ String
+ *
+
+
+ includes
+
+ Include
+ *
+
+
+
+ excludes
+
+ Exclude
+ *
+
+
+
+
+
+ Exclude
+
+
+ value
+ String
+
+
+
+
+ Include
+
+
+ value
+ String
+
+
+ recursive
+ boolean
+ true
+
+
+ glob
+ String
+ *
+
+
+
+
+
+
+
+
+
+ GoalReconciliationType
+ GoalIdType
+
+
+ reconciles
+
+ TrackedPropertyType
+ *
+
+
+
+ logs
+
+ PropertyNameType
+ *
+
+ Specify property which should be logged to build metadata for exploration
+
+
+ nologs
+
+ PropertyNameType
+ *
+
+ Specify property which should not be logged
+
+
+ logAll
+ boolean
+ true
+ Controls if all plugin properties to be logged (true is default). All the properties logged
+ with respect to log/nolog children:
+ * true: logged all if no blacklists (<nolog/>) and whitelists (<log/>) specified on plugin
+ level
+ * false: logged only tracked and included by whitelists (<log/>) on plugin level
+
+
+
+
+
+
+
+
+ ExecutionControlType
+
+
+ runAlways
+
+ ExecutablesType
+
+ Specify which plugin should run always if present in build regardless of cached status
+
+
+ ignoreMissing
+
+ ExecutablesType
+
+
+ Specify which executions/plugins/goals do not affect generated artifacts and do not affect build correctness.
+ If cached build lacks of ignorable executions only, it still could be reused.
+ Typically case is then cached build is produced with 'verify' and you locally you run 'install'.
+ Strictly speaking these are different builds but in most of cases you want this difference to be ignored
+
+
+
+ reconcile
+
+ Reconcile
+
+ Specify which plugin should run always if present in build regardless of cached status
+
+
+
+
+
+
+
+ Reconcile
+
+
+ plugins
+
+ GoalReconciliationType
+ *
+
+ Reconciliation rules for plugin properties which might be affected by command line flags, etc
+
+
+ logAllProperties
+ boolean
+ true
+
+ Controls if all plugin properties to be logged (true is default). All the properties
+ logged with respect to children:
+ * logAll on plugin level overrides global value
+ * true: logged all if no blacklists (<nolog/>) and whitelists (<log/>) specified on
+ plugin level
+ * false: logged only tracked and included by whitelists (<log/>) on plugin level
+ <log/>
+
+
+
+
+
+
+
+
+ ExecutablesType
+
+
+ plugins
+
+ PluginSetType
+ *
+
+ Specify which executions should run always if present in build regardless of cached status
+
+
+ executions
+
+ ExecutionIdsListType
+ *
+
+ Specify which executions should run always if present in build regardless of cached status
+
+
+ goalsLists
+
+ GoalsListType
+ *
+
+ Specify which goals should run always if present in build regardless of cached status
+
+
+
+
+
+
+
+ GoalsListType
+ CoordinatesBaseType
+
+
+ goals
+
+ String
+ *
+
+ Goals identification
+
+
+
+
+
+
+
+ GoalIdType
+ CoordinatesBaseType
+
+
+ goal
+ String
+ true
+
+
+
+
+
+
+
+ ExecutionIdsListType
+ CoordinatesBaseType
+
+
+ execIds
+
+ String
+ *
+
+ Executions ids list with plugin identifier
+
+
+
+
+
+
+
+ PluginSetType
+ CoordinatesBaseType
+
+
+
+
+
+ CoordinatesBaseType
+
+
+ groupId
+ String
+
+
+ artifactId
+ String
+
+
+
+
+
+
+
+ TagNameType
+
+
+ tagName
+ String
+ true
+
+
+
+
+
+
+
+ PropertyNameType
+
+
+ value
+ String
+
+
+ propertyName
+ String
+
+
+
+
+
+
+
+ TrackedPropertyType
+
+
+ value
+ String
+
+
+ propertyName
+ String
+
+
+ skipValue
+ String
+
+
+ defaultValue
+ String
+
+
+
+
+
+
+
+
diff --git a/maven-core/src/main/mdo/cache-diff.mdo b/maven-core/src/main/mdo/cache-diff.mdo
new file mode 100644
index 000000000000..d9c3d182ed1e
--- /dev/null
+++ b/maven-core/src/main/mdo/cache-diff.mdo
@@ -0,0 +1,109 @@
+
+
+
+ cache-diff
+ CacheDiff
+
+
+
+ package
+ org.apache.maven.caching.domain
+
+
+
+
+
+
+
+ BuildDiffType
+
+
+ mismatch
+
+ MismatchType
+ *
+
+
+
+
+
+
+
+
+ MismatchType
+
+
+ detail
+
+ MismatchDetailType
+ *
+
+
+
+ item
+ String
+
+
+ current
+ String
+
+
+ baseline
+ String
+
+
+ reason
+ String
+
+
+ resolution
+ String
+
+
+ context
+ String
+
+
+
+
+
+
+ MismatchDetailType
+
+
+
+
diff --git a/maven-core/src/main/mdo/cache-domain.mdo b/maven-core/src/main/mdo/cache-domain.mdo
new file mode 100644
index 000000000000..43c353041ba8
--- /dev/null
+++ b/maven-core/src/main/mdo/cache-domain.mdo
@@ -0,0 +1,385 @@
+
+
+
+ cache-domain
+ CacheDomain
+
+
+
+ package
+ org.apache.maven.caching.domain
+
+
+
+
+
+ BuildInfoType
+ 1.0.0+
+ extension.xml file.]]>
+
+
+
+
+ cacheImplementationVersion
+ 1.0.0+
+ String
+
+
+
+ _final
+ 1.0.0+
+ Boolean
+ final
+
+
+
+ hashFunction
+ 1.0.0+
+ String
+
+
+
+ buildTime
+ 1.0.0+
+ Date
+
+
+
+ buildServer
+ 1.0.0+
+ String
+
+
+
+ scm
+ 1.0.0+
+
+ Scm
+
+
+
+
+ goals
+ 1.0.0+
+
+ String
+ *
+
+
+
+
+
+ artifact
+ 1.0.0+
+
+ ArtifactType
+
+
+
+
+
+ attachedArtifacts
+
+ ArtifactType
+ *
+
+
+
+
+
+ executions
+
+ CompletedExecutionType
+ *
+
+
+
+
+ projectsInputInfo
+
+ ProjectsInputInfoType
+
+
+
+
+
+
+
+ Scm
+
+
+ sourceBranch
+ String
+
+
+ revision
+ String
+
+
+
+
+
+
+ ArtifactType
+
+
+
+
+ groupId
+ String
+
+
+
+ artifactId
+ String
+
+
+
+ version
+ String
+
+
+
+ classifier
+ String
+
+
+
+ type
+ String
+
+
+
+ scope
+ String
+
+
+
+ fileName
+ String
+
+
+
+ fileHash
+ String
+
+
+
+
+ fileSize
+ long
+
+
+
+
+
+
+
+
+ CompletedExecutionType
+
+
+ executionKey
+ String
+
+
+ mojoClassName
+ String
+
+
+ configuration
+
+ PropertyValueType
+ *
+
+
+
+
+
+
+
+
+ PropertyValueType
+
+
+ value
+ String
+
+
+ name
+ String
+
+
+ tracked
+ Boolean
+
+
+
+
+
+
+
+ ProjectsInputInfoType
+
+
+ checksum
+ String
+
+
+ item
+
+ DigestItemType
+ *
+
+
+
+
+
+
+
+
+ DigestItemType
+
+
+ value
+ String
+
+
+ type
+ String
+
+
+ hash
+ String
+
+
+ fileChecksum
+ String
+
+
+ content
+ String
+
+
+ isText
+ String
+
+
+ charset
+ String
+
+
+ eol
+ String
+
+
+
+
+
+
diff --git a/maven-core/src/main/mdo/cache-report.mdo b/maven-core/src/main/mdo/cache-report.mdo
new file mode 100644
index 000000000000..3e7b8f3b9a1e
--- /dev/null
+++ b/maven-core/src/main/mdo/cache-report.mdo
@@ -0,0 +1,108 @@
+
+
+
+ cache-report
+ CacheReport
+
+
+
+ package
+ org.apache.maven.caching.domain
+
+
+
+
+
+ CacheReportType
+
+
+ project
+
+ ProjectReportType
+ *
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ProjectReportType
+
+
+ groupId
+ String
+
+
+ artifactId
+ String
+
+
+ checksum
+ String
+
+
+ checksumMatched
+ Boolean
+
+
+ lifecycleMatched
+ Boolean
+
+
+ pluginsMatched
+ Boolean
+
+
+ source
+ String
+
+
+ sharedToRemote
+ Boolean
+
+
+ url
+ String
+
+
+
+
+
+
diff --git a/maven-core/src/main/resources/cache-config-instance.xml b/maven-core/src/main/resources/cache-config-instance.xml
deleted file mode 100644
index 68555927800a..000000000000
--- a/maven-core/src/main/resources/cache-config-instance.xml
+++ /dev/null
@@ -1,112 +0,0 @@
-
-
-
-
-
-
-
- true
- SHA-256
- true
-
- http://host:port
-
-
- 3
-
-
-
-
-
-
- {*.java,*.groovy,*.yaml,*.svcd,*.proto,*assembly.xml,assembly*.xml,*logback.xml,*.vm,*.ini,*.jks,*.properties,*.sh,*.bat}
-
- src/
- pom.xml
-
-
-
- 111
-
-
-
-
-
-
-
- 1
- 2
-
-
-
-
-
-
-
-
-
-
-
- aaa
-
-
- install
-
-
- deploy
-
-
- deploy-local
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/maven-core/src/main/resources/cache-config.xsd b/maven-core/src/main/resources/cache-config.xsd
deleted file mode 100644
index 69437d993300..000000000000
--- a/maven-core/src/main/resources/cache-config.xsd
+++ /dev/null
@@ -1,640 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Cached build metadata
-
-
-
-
-
-
-
-
-
- Configuration of major cache properties
-
-
-
-
-
-
- Configuration for source code input files participating in checksum calculation
-
-
-
-
-
-
- Configuration for output artifacts, it's needed if you want to explicitly include/exclude something from caching
-
-
-
-
-
-
- Execution rules for plugins in cached mode. Defines which plugins should run always
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 64 bit XX family hashing. Fast, but higher probability of collisions
-
-
-
-
-
-
- 64 bit XX family hashing, with usage of Memory Mapped Buffer
-
-
-
-
-
-
-
-
-
-
-
-
-
- Validate cache config and builds metadata against xsd.
-
-
-
-
-
-
- Specifies how to identify belonging to a cached project then submodule is being build.
-
-
-
-
-
-
-
- Any project dependency this this version will be considered cache eligible and will
- be processed cache aware
-
-
-
-
-
-
-
-
-
-
-
-
- address of remote cache
-
-
-
-
-
-
-
-
- Save output to remote cache. Recommended to enable on CI agents only.
-
-
-
-
-
-
-
-
-
-
-
- Directory name in build output directory to attach to cached artifacts
-
-
-
-
-
-
-
-
-
-
-
-
- Maximum number of cached build per artifact in local cache. First created cache (the
- oldest) is
- evicted if breached.
-
-
-
-
-
-
-
-
-
-
-
-
- Causes file hash is saved in build metadata
-
-
-
-
-
-
- Causes effective pom info is saved in build metadata
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Global input calculation rules applicable to all projects and plugins in the build
-
-
-
-
-
-
- Plugin specific input calculation rules
-
-
-
-
-
-
-
-
-
-
-
-
-
- Effective pom calculation rules
-
-
-
-
-
-
-
- Plugin configuration property should be excluded from effective pom
- calculation
-
-
-
-
-
-
-
-
-
- Specifies plugin level rules of configuration processing in search of referenced source
- files
-
-
-
-
-
-
- Specifies execution specific configuration processing in search of referenced source
- files
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Specifies rules of configuration processing in search of referenced source files
-
-
-
-
-
-
-
- ignore parent config or inherit/merge
-
-
-
-
-
-
-
-
- Common attributes for scanning paths
-
-
-
-
-
- Should walk directory specified in property recursively or not
-
-
-
-
-
-
- Glob to apply when scanning dir denoted by this property
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Forces cache to treat property value as input and include in calculation. If set, only included
- properties will be takein in calculation (whitelist)
-
-
-
-
-
-
-
- Tag to exclude when scanning plugin configuration for input files (blacklist)
-
-
-
-
-
-
- Additional processing rules for non-blacklisted tags
-
-
-
-
-
-
-
-
-
- Ignore parent settings or inherit and merge
-
-
-
-
-
-
-
-
-
-
- Scan directory accordingly to cache implementation
-
-
-
-
-
-
- Skip directory
-
-
-
-
-
-
-
-
-
-
-
-
-
- Patterns to exclude output artifacts applicable to all projects in the build
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Specify property which should be reconciled against running build
-
-
-
-
-
-
- Specify property which should be logged to build metadata for exploration
-
-
-
-
-
-
- Specify property which should not be logged
-
-
-
-
-
-
-
- Controls if all plugin properties to be logged (true is default). All the properties logged
- with respect to log/nolog children:
- * true: logged all if no blacklists () and whitelists () specified on plugin
- level
- * false: logged only tracked and included by whitelists () on plugin level
-
-
-
-
-
-
-
-
-
-
-
-
- Specify which plugin should run always if present in build regardless of cached status
-
-
-
-
-
-
- Specify which executions/plugins/goals do not affect generated artifacts and do not affect build correctness.
- If cached build lacks of ignorable executions only, it still could be reused.
- Typically case is then cached build is produced with 'verify' and you locally you run 'install'.
- Strictly speaking these are different builds but in most of cases you want this difference to be ignored
-
-
-
-
-
-
- Specify which plugin should run always if present in build regardless of cached status
-
-
-
-
-
-
-
- Reconciliation rules for plugin properties which might be affected by command line
- flags, etc
-
-
-
-
-
-
-
- Controls if all plugin properties to be logged (true is default). All the properties
- logged with respect to children:
- * logAll on plugin level overrides global value
- * true: logged all if no blacklists () and whitelists () specified on
- plugin level
- * false: logged only tracked and included by whitelists () on plugin level
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Specify which plugin should run always if present in build regardless of cached status
-
-
-
-
-
-
- Specify which executions should run always if present in build regardless of cached status
-
-
-
-
-
-
- Specify which goals should run always if present in build regardless of cached status
-
-
-
-
-
-
-
-
-
-
-
-
-
- Goals identification
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Executions ids list with plugin identifier
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Specify which value denotes skipped execution in plugin config.
- If active build skips execution (property set to skipValue) cache will allow such
- discrepancy.
-
-
-
-
-
-
- Manual value for reconciliation. Required to reconcile runtime only properties
-
-
-
-
-
-
-
-
diff --git a/maven-core/src/main/resources/cache-domain.xsd b/maven-core/src/main/resources/cache-domain.xsd
deleted file mode 100644
index c233ed46e463..000000000000
--- a/maven-core/src/main/resources/cache-domain.xsd
+++ /dev/null
@@ -1,187 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/maven-core/src/test/java/org/apache/maven/caching/BuildInfoTest.java b/maven-core/src/test/java/org/apache/maven/caching/BuildInfoTest.java
index 6c9b14c418aa..19c1de408a16 100644
--- a/maven-core/src/test/java/org/apache/maven/caching/BuildInfoTest.java
+++ b/maven-core/src/test/java/org/apache/maven/caching/BuildInfoTest.java
@@ -25,29 +25,29 @@
import org.apache.maven.artifact.DefaultArtifact;
import org.apache.maven.artifact.handler.DefaultArtifactHandler;
import org.apache.maven.caching.hash.HashFactory;
-import org.apache.maven.caching.jaxb.ArtifactType;
-import org.apache.maven.caching.jaxb.BuildInfoType;
-import org.apache.maven.caching.jaxb.CompletedExecutionType;
-import org.apache.maven.caching.jaxb.DigestItemType;
-import org.apache.maven.caching.jaxb.ProjectsInputInfoType;
-import org.apache.maven.caching.jaxb.PropertyValueType;
+import org.apache.maven.caching.domain.ArtifactType;
+import org.apache.maven.caching.domain.BuildInfoType;
+import org.apache.maven.caching.domain.CompletedExecutionType;
+import org.apache.maven.caching.domain.DigestItemType;
+import org.apache.maven.caching.domain.ProjectsInputInfoType;
+import org.apache.maven.caching.domain.PropertyValueType;
import org.apache.maven.caching.xml.BuildInfo;
import org.apache.maven.caching.xml.XmlService;
+import org.junit.Test;
-import javax.xml.datatype.DatatypeFactory;
import java.io.File;
-import java.math.BigInteger;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
-import java.util.GregorianCalendar;
-
-import static org.apache.maven.caching.xml.BuildInfo.createGoals;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
public class BuildInfoTest {
- // @Test
+ @Test
public void name() throws Exception {
XmlService xmlService = new XmlService();
@@ -64,16 +64,16 @@ public void name() throws Exception {
artifact.setClassifier("c");
artifact.setScope("s");
artifact.setFileName("f");
- artifact.setFileSize(BigInteger.valueOf(123456));
+ artifact.setFileSize(123456);
artifact.setFileHash("456L");
BuildInfoType buildInfo = new BuildInfoType();
buildInfo.setCacheImplementationVersion("cacheImplementationVersion");
buildInfo.setBuildServer("server");
- buildInfo.setBuildTime(DatatypeFactory.newInstance().newXMLGregorianCalendar(new GregorianCalendar()));
+ buildInfo.setBuildTime(new Date());
buildInfo.setArtifact(artifact);
buildInfo.setHashFunction("SHA-256");
- buildInfo.setGoals(createGoals(Lists.newArrayList("install")));
+ buildInfo.setGoals(Lists.newArrayList("install"));
final Artifact attachedArtifact = new DefaultArtifact("ag", "aa", "av", "as", "at", "ac", new DefaultArtifactHandler());
buildInfo.setAttachedArtifacts(BuildInfo.createAttachedArtifacts(Lists.newArrayList(attachedArtifact), HashFactory.XX.createAlgorithm()));
buildInfo.setProjectsInputInfo(main);
@@ -90,17 +90,14 @@ public void name() throws Exception {
System.out.println(buildInfo1);
}
- private BuildInfoType.Executions createExecutions() {
+ private List createExecutions() {
CompletedExecutionType execution = new CompletedExecutionType();
execution.setExecutionKey("execkey");
- execution.setConfiguration(new CompletedExecutionType.Configuration());
PropertyValueType property = new PropertyValueType();
property.setValue("value");
property.setName("key");
- execution.getConfiguration().getProperty().add(property);
- BuildInfoType.Executions executions = new BuildInfoType.Executions();
- executions.getExecution().add(execution);
- return executions;
+ execution.setConfiguration(new ArrayList<>(Arrays.asList(property)));
+ return new ArrayList<>(Arrays.asList(execution));
}
private DigestItemType createItem(String pom, String s, String hash1) {
diff --git a/maven-core/src/test/java/org/apache/maven/caching/xml/CacheConfigTest.java b/maven-core/src/test/java/org/apache/maven/caching/xml/CacheConfigTest.java
index b18752fd0594..c589181cf066 100644
--- a/maven-core/src/test/java/org/apache/maven/caching/xml/CacheConfigTest.java
+++ b/maven-core/src/test/java/org/apache/maven/caching/xml/CacheConfigTest.java
@@ -19,8 +19,10 @@
* under the License.
*/
+import org.apache.maven.caching.domain.CacheType;
import org.junit.Test;
+import java.io.InputStream;
import java.nio.file.Path;
import java.nio.file.Paths;
@@ -28,8 +30,8 @@ public class CacheConfigTest {
@Test
public void testMU() {
-// final Path path = Paths.get("W:\\dev\\abfx\\maven-cache-config.xml");
-// final CacheConfig cacheConfig = CacheConfig.fromFile(path.toFile());
-// System.out.println(cacheConfig.toString());
+ InputStream is = getClass().getResourceAsStream( "cache-config-instance.xml" );
+ final CacheType cacheConfig = new XmlService().fromInputStream( CacheType.class, is );
+ System.out.println(cacheConfig.toString());
}
}
\ No newline at end of file
diff --git a/maven-core/src/test/resources/org/apache/maven/caching/xml/cache-config-instance.xml b/maven-core/src/test/resources/org/apache/maven/caching/xml/cache-config-instance.xml
new file mode 100644
index 000000000000..92e3ce767fa0
--- /dev/null
+++ b/maven-core/src/test/resources/org/apache/maven/caching/xml/cache-config-instance.xml
@@ -0,0 +1,160 @@
+
+
+
+
+
+
+
+ true
+ SHA-256
+ true
+
+ http://host:port
+
+
+ 3
+
+
+
+
+
+
+ {*.java,*.groovy,*.yaml,*.svcd,*.proto,*assembly.xml,assembly*.xml,*logback.xml,*.vm,*.ini,*.jks,*.properties,*.sh,*.bat}
+
+
+ src/
+
+
+ pom.xml
+
+
+
+
+
+
+ 111
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ aaa
+
+
+
+
+
+
+ install
+
+
+
+
+ deploy
+
+
+
+
+ deploy-local
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/maven-core/src/main/resources/cache-domain-instance.xml b/maven-core/src/test/resources/org/apache/maven/caching/xml/cache-domain-instance.xml
similarity index 100%
rename from maven-core/src/main/resources/cache-domain-instance.xml
rename to maven-core/src/test/resources/org/apache/maven/caching/xml/cache-domain-instance.xml