From dc0928fcc3fe02353c58104d0cd86a8e66e92564 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Sun, 17 Oct 2021 23:21:20 +0200 Subject: [PATCH 1/8] [MNG-7324] first step to use Modello for cache-domain --- maven-core/pom.xml | 29 ++- maven-core/src/main/mdo/cache-domain.mdo | 296 +++++++++++++++++++++++ 2 files changed, 324 insertions(+), 1 deletion(-) create mode 100644 maven-core/src/main/mdo/cache-domain.mdo diff --git a/maven-core/pom.xml b/maven-core/pom.xml index 9dd0250754e4..b1e830e7c3c5 100644 --- a/maven-core/pom.xml +++ b/maven-core/pom.xml @@ -217,7 +217,34 @@ 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 + + + 1.0.0 + + src/main/mdo/cache-domain.mdo + + + + + modello-site-docs-extension pre-site xdoc 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..cb0ba6db99f9 --- /dev/null +++ b/maven-core/src/main/mdo/cache-domain.mdo @@ -0,0 +1,296 @@ + + + + cache-domain + CacheDomain + + + + package + org.apache.maven.caching.domain + + + + + + BuildInfoType + 1.0.0+ + extension.xml file.]]> + + + + cacheImplementationVersion + 1.0.0+ + String + + + + + + + hashFunction + 1.0.0+ + String + + + + + + buildServer + 1.0.0+ + String + + + + + + + goals + 1.0.0+ + + String + * + + + + + + artifact + 1.0.0+ + + ArtifactType + + + + + + + + + + ArtifactType + + + + + groupId + 1.0.0+ + String + + + + + artifactId + 1.0.0+ + String + + + + + version + 1.0.0+ + String + + + + + classifier + 1.0.0+ + String + + + + + type + 1.0.0+ + String + + + + + scope + 1.0.0+ + String + + + + + fileName + 1.0.0+ + String + + + + + fileHash + 1.0.0+ + String + + + + + + + + + + + + + + + + + From fe5e0ffe34707703018514a23d72bd0ba32bb92d Mon Sep 17 00:00:00 2001 From: Guillaume Nodet Date: Thu, 4 Nov 2021 20:57:07 +0100 Subject: [PATCH 2/8] [MNG-7324] Complete modello switch --- maven-core/pom.xml | 7 + .../maven/caching/ArtifactsRepository.java | 2 +- .../apache/maven/caching/CacheContext.java | 2 +- .../maven/caching/CacheControllerImpl.java | 29 +- .../org/apache/maven/caching/CacheDiff.java | 28 +- .../org/apache/maven/caching/CacheResult.java | 2 +- .../caching/DefaultPluginScanConfig.java | 2 +- .../maven/caching/HttpRepositoryImpl.java | 10 +- .../caching/LocalArtifactsRepository.java | 2 +- .../maven/caching/LocalRepositoryImpl.java | 11 +- .../maven/caching/MojoExecutionManager.java | 6 +- .../maven/caching/PluginScanConfig.java | 2 +- .../maven/caching/PluginScanConfigImpl.java | 8 +- .../apache/maven/caching/ProjectUtils.java | 6 +- .../caching/RemoteArtifactsRepository.java | 2 +- .../maven/caching/checksum/DigestUtils.java | 2 +- .../maven/caching/checksum/KeyUtils.java | 2 +- .../caching/checksum/MavenProjectInput.java | 6 +- .../apache/maven/caching/xml/BuildInfo.java | 72 +- .../apache/maven/caching/xml/CacheConfig.java | 8 +- .../maven/caching/xml/CacheConfigImpl.java | 68 +- .../apache/maven/caching/xml/DtoUtils.java | 69 +- .../apache/maven/caching/xml/XmlService.java | 149 +- maven-core/src/main/mdo/cache-config.mdo | 1390 +++++++++++++++++ maven-core/src/main/mdo/cache-diff.mdo | 109 ++ maven-core/src/main/mdo/cache-domain.mdo | 365 +++-- maven-core/src/main/mdo/cache-report.mdo | 108 ++ .../apache/maven/caching/BuildInfoTest.java | 39 +- 28 files changed, 2080 insertions(+), 426 deletions(-) create mode 100644 maven-core/src/main/mdo/cache-config.mdo create mode 100644 maven-core/src/main/mdo/cache-diff.mdo create mode 100644 maven-core/src/main/mdo/cache-report.mdo diff --git a/maven-core/pom.xml b/maven-core/pom.xml index b1e830e7c3c5..bdd55438708e 100644 --- a/maven-core/pom.xml +++ b/maven-core/pom.xml @@ -235,11 +235,16 @@ under the License. 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 @@ -275,6 +280,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/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..e95342c2f1ed 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; @@ -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() ); } 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..ca78adaba6b0 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 @@ -36,8 +36,9 @@ 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 +95,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 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..e07ce6a9b74e 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 @@ -22,9 +22,9 @@ import org.apache.maven.caching.PluginScanConfig; import org.apache.maven.caching.checksum.MultimoduleDiscoveryStrategy; 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,7 +62,7 @@ public interface CacheConfig String getDefaultGlob(); @Nonnull - List getGlobalIncludePaths(); + List getGlobalIncludePaths(); @Nonnull List getGlobalExcludePaths(); 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..7946942aee63 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,25 @@ 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.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; @@ -202,20 +206,20 @@ 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; } @@ -276,7 +280,7 @@ 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(); } @@ -286,7 +290,7 @@ public List getEffectivePomExcludeProperties( Plugin plugin ) private PluginConfigurationScanType findPluginScanConfig( Plugin plugin ) { - if ( !cacheConfig.isSetInput() ) + if ( cacheConfig.getInput() == null ) { return null; } @@ -305,7 +309,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 +320,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(); } @@ -335,7 +339,7 @@ public PluginScanConfig getExecutionDirScanConfig( Plugin plugin, PluginExecutio { final ExecutionConfigurationScanType executionScanConfig = findExecutionScanConfig( exec, pluginScanConfig.getExecution() ); - if ( executionScanConfig != null && executionScanConfig.isSetDirScan() ) + if ( executionScanConfig != null && executionScanConfig.getDirScan() != null ) { return new PluginScanConfigImpl( executionScanConfig.getDirScan() ); } @@ -373,7 +377,7 @@ public String getDefaultGlob() @Nonnull @Override - public List getGlobalIncludePaths() + public List getGlobalIncludePaths() { checkInitializedState(); return cacheConfig.getInput().getGlobal().getInclude(); @@ -392,9 +396,9 @@ public List getGlobalExcludePaths() public MultimoduleDiscoveryStrategy getMultimoduleDiscoveryStrategy() { checkInitializedState(); - final ConfigurationType.ProjectDiscoveryStrategy projectDiscoveryStrategy = + final ProjectDiscoveryStrategy projectDiscoveryStrategy = cacheConfig.getConfiguration().getProjectDiscoveryStrategy(); - if ( projectDiscoveryStrategy.isSetSpecificVersion() ) + if ( projectDiscoveryStrategy.getSpecificVersion() != null ) { return new SentinelVersionStartegy( projectDiscoveryStrategy.getSpecificVersion() ); } @@ -413,7 +417,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 +429,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; } @@ -524,14 +528,14 @@ 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(); + final AttachedOutputs attachedOutputs = getConfiguration().getAttachedOutputs(); return attachedOutputs == null ? Collections.emptyList() : attachedOutputs.getDirName(); } @@ -545,7 +549,7 @@ 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() ) @@ -557,12 +561,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..f63ffe6c9cb5 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,26 @@ * 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.InputStream; +import java.io.IOException; +import java.nio.file.Files; /** * XmlService @@ -48,98 +47,94 @@ public class XmlService { - private final ObjectFactory objectFactory; - private final JAXBContext jaxbContext; - private final Schema schema; - - public XmlService() throws JAXBException, SAXException + public byte[] toBytes( CacheType cache ) throws IOException { - 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} ); + try ( ByteArrayOutputStream baos = new ByteArrayOutputStream() ) + { + new CacheConfigXpp3Writer().write( baos, cache ); + return baos.toByteArray(); + } } - public byte[] toBytes( BuildInfoType buildInfo ) + public byte[] toBytes( BuildInfoType buildInfo ) throws IOException { - return serializeXml( objectFactory.createBuild( buildInfo ) ); + try ( ByteArrayOutputStream baos = new ByteArrayOutputStream() ) + { + new CacheDomainXpp3Writer().write( baos, buildInfo ); + return baos.toByteArray(); + } } - public byte[] toBytes( BuildDiffType diff ) + public byte[] toBytes( BuildDiffType diff ) throws IOException { - return serializeXml( objectFactory.createDiff( diff ) ); + try ( ByteArrayOutputStream baos = new ByteArrayOutputStream() ) + { + new CacheDiffXpp3Writer().write( baos, diff ); + return baos.toByteArray(); + } } - public byte[] toBytes( CacheReportType cacheReportType ) + public byte[] toBytes( CacheReportType cacheReportType ) throws IOException { - - return serializeXml( objectFactory.createReport( cacheReportType ) ); + try ( ByteArrayOutputStream baos = new ByteArrayOutputStream() ) + { + new CacheReportXpp3Writer().write( baos, cacheReportType ); + return baos.toByteArray(); + } } - private byte[] serializeXml( JAXBElement element ) + public T fromFile( Class clazz, File file ) throws IOException, XmlPullParserException { - try + if ( clazz == BuildInfoType.class ) { - 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 ); - return baos.toByteArray(); + return clazz.cast( new CacheDomainXpp3Reader().read( Files.newInputStream( file.toPath() ) ) ); } - catch ( Exception e ) + else if ( clazz == CacheType.class ) { - throw new RuntimeException( "Errors in jaxb serialization: " + e.toString(), e ); + return clazz.cast( new CacheConfigXpp3Reader().read( Files.newInputStream( file.toPath() ) ) ); } - } - - public T fromFile( Class clazz, File file ) - { - - try + else if ( clazz == BuildDiffType.class ) { - Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); - unmarshaller.setSchema( schema ); - JAXBElement result = (JAXBElement) unmarshaller.unmarshal( file ); - return result.getValue(); + return clazz.cast( new CacheDiffXpp3Reader().read( Files.newInputStream( file.toPath() ) ) ); } - catch ( Exception e ) + else if ( clazz == CacheReportType.class ) { - throw new RuntimeException( "Errors in jaxb serialization: " + e.toString(), e ); + return clazz.cast( new CacheReportXpp3Reader().read( Files.newInputStream( file.toPath() ) ) ); } - } - - public static InputStream getResourceAsStream( String name ) - { - ClassLoader cl = XmlService.class.getClassLoader(); - if ( cl == null ) + else { - // A system class. - return ClassLoader.getSystemResourceAsStream( name ); + throw new IllegalArgumentException( "Unsupported type " + clazz ); } - return cl.getResourceAsStream( name ); } public T fromBytes( Class clazz, byte[] bytes ) { 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( new ByteArrayInputStream( bytes ) ) ); + } + else if ( clazz == CacheType.class ) + { + return clazz.cast( new CacheConfigXpp3Reader().read( new ByteArrayInputStream( bytes ) ) ); + } + else if ( clazz == BuildDiffType.class ) + { + return clazz.cast( new CacheDiffXpp3Reader().read( new ByteArrayInputStream( bytes ) ) ); + } + else if ( clazz == CacheReportType.class ) + { + return clazz.cast( new CacheReportXpp3Reader().read( new ByteArrayInputStream( bytes ) ) ); + } + 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/mdo/cache-config.mdo b/maven-core/src/main/mdo/cache-config.mdo new file mode 100644 index 000000000000..dfd4bf651863 --- /dev/null +++ b/maven-core/src/main/mdo/cache-config.mdo @@ -0,0 +1,1390 @@ + + + + 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 + + + + debug + + 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 + + + dirName + + 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 + + + plugin + + 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 + + + execution + + ExecutionConfigurationScanType + * + + Specifies execution specific configuration processing in search of referenced source files + + + + + + + EffectivePom + + + excludeProperty + + String + * + + Plugin configuration property should be excluded from effective pom calculation + + + + + + + ExecutionConfigurationScanType + + + execId + + 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 + + + include + + TagScanConfigType + * + + Forces cache to treat property value as input and include in calculation. If set, only included + properties will be takein in calculation (whitelist) + + + exclude + + TagNameType + * + + Tag to exclude when scanning plugin configuration for input files (blacklist) + + + tagScanConfig + + 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 + + + pattern + + String + * + + + + + + + + PathSetType + + + glob + String + * + + + include + + Include + * + + + + exclude + + String + * + + + + + + Include + + + value + String + + + recursive + boolean + true + + + glob + String + * + + + + + + + + + + GoalReconciliationType + GoalIdType + + + reconcile + + TrackedPropertyType + * + + + + log + + PropertyNameType + * + + Specify property which should be logged to build metadata for exploration + + + nolog + + 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 + + + plugin + + 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 + + + plugin + + PluginSetType + * + + Specify which executions should run always if present in build regardless of cached status + + + execution + + ExecutionIdsListType + * + + Specify which executions should run always if present in build regardless of cached status + + + goals + + GoalsListType + * + + Specify which goals should run always if present in build regardless of cached status + + + + + + + + GoalsListType + CoordinatesBaseType + + + goal + + String + * + + Goals identification + + + + + + + + GoalIdType + CoordinatesBaseType + + + goal + String + true + + + + + + + + ExecutionIdsListType + CoordinatesBaseType + + + execId + + 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..e2a9cfec34c9 --- /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 index cb0ba6db99f9..43c353041ba8 100644 --- a/maven-core/src/main/mdo/cache-domain.mdo +++ b/maven-core/src/main/mdo/cache-domain.mdo @@ -18,7 +18,8 @@ under the License. --> + xsi:schemaLocation="http://codehaus-plexus.github.io/MODELLO/1.4.0 http://codehaus-plexus.github.io/modello/xsd/modello-1.4.0.xsd" + xsd.namespace="org:apache:maven:cache:domain"> cache-domain CacheDomain 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+ @@ -90,7 +100,7 @@ under the License. - + artifact 1.0.0+ @@ -99,109 +109,137 @@ under the License. - + + + attachedArtifacts + + ArtifactType + * + + + + + + executions + + CompletedExecutionType + * + + + + + projectsInputInfo + + ProjectsInputInfoType + + + + + + + + Scm + + + sourceBranch + String + + + revision + String + ArtifactType - + - + groupId - 1.0.0+ String - - + artifactId - 1.0.0+ String - - + version - 1.0.0+ String - - + classifier - 1.0.0+ String - - + type - 1.0.0+ String - - + scope - 1.0.0+ String - - + fileName - 1.0.0+ String - - + fileHash - 1.0.0+ String - - + - + + fileSize + long + + @@ -218,25 +256,80 @@ under the License. - + + + CompletedExecutionType + + + executionKey + String + + + mojoClassName + String + + + configuration + + PropertyValueType + * + + + + - + - + + PropertyValueType + + + value + String + + + name + String + + + tracked + Boolean + + + + + - + + ProjectsInputInfoType + + + checksum + String + + + item + + DigestItemType + * + + + + + + - - - - - - - - - - - - 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..d08194633954 --- /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/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) { From a20cb86dc6885ccca2ac791a117fd35d33738f17 Mon Sep 17 00:00:00 2001 From: Guillaume Nodet Date: Fri, 5 Nov 2021 14:59:32 +0100 Subject: [PATCH 3/8] [MNG-7324] Use plurals in the schema, make sure it can read things correctly --- maven-core/pom.xml | 1 + .../maven/caching/PluginScanConfigImpl.java | 16 +- .../caching/checksum/MavenProjectInput.java | 6 +- .../maven/caching/hash/CloseableBuffer.java | 21 +- .../org/apache/maven/caching/hash/XXMM.java | 4 +- .../apache/maven/caching/xml/CacheConfig.java | 3 +- .../maven/caching/xml/CacheConfigImpl.java | 37 +- .../apache/maven/caching/xml/XmlService.java | 35 +- maven-core/src/main/mdo/cache-config.mdo | 61 +- maven-core/src/main/mdo/cache-diff.mdo | 2 +- maven-core/src/main/mdo/cache-report.mdo | 2 +- .../main/resources/cache-config-instance.xml | 112 --- .../src/main/resources/cache-config.xsd | 640 ------------------ .../src/main/resources/cache-domain.xsd | 187 ----- .../maven/caching/xml/CacheConfigTest.java | 8 +- .../caching/xml/cache-config-instance.xml | 160 +++++ .../caching/xml}/cache-domain-instance.xml | 0 17 files changed, 259 insertions(+), 1036 deletions(-) delete mode 100644 maven-core/src/main/resources/cache-config-instance.xml delete mode 100644 maven-core/src/main/resources/cache-config.xsd delete mode 100644 maven-core/src/main/resources/cache-domain.xsd create mode 100644 maven-core/src/test/resources/org/apache/maven/caching/xml/cache-config-instance.xml rename maven-core/src/{main/resources => test/resources/org/apache/maven/caching/xml}/cache-domain-instance.xml (100%) diff --git a/maven-core/pom.xml b/maven-core/pom.xml index bdd55438708e..5ff2215e2420 100644 --- a/maven-core/pom.xml +++ b/maven-core/pom.xml @@ -246,6 +246,7 @@ under the License. src/main/mdo/cache-diff.mdo src/main/mdo/cache-report.mdo + ${basedir}/target/generated-sources/modello 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 e95342c2f1ed..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 @@ -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 ) @@ -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/checksum/MavenProjectInput.java b/maven-core/src/main/java/org/apache/maven/caching/checksum/MavenProjectInput.java index ca78adaba6b0..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,6 +33,7 @@ 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; @@ -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/CacheConfig.java b/maven-core/src/main/java/org/apache/maven/caching/xml/CacheConfig.java index e07ce6a9b74e..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,6 +21,7 @@ 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.domain.Include; import org.apache.maven.caching.domain.PropertyNameType; @@ -65,7 +66,7 @@ public interface CacheConfig 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 7946942aee63..137bcc669de4 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 @@ -27,6 +27,7 @@ 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; @@ -190,7 +191,7 @@ public List getTrackedProperties( MojoExecution mojoExecuti final GoalReconciliationType reconciliationConfig = findReconciliationConfig( mojoExecution ); if ( reconciliationConfig != null ) { - return reconciliationConfig.getReconcile(); + return reconciliationConfig.getReconciles(); } else { @@ -224,7 +225,7 @@ private GoalReconciliationType findReconciliationConfig( MojoExecution mojoExecu return null; } - final List reconciliation = executionControl.getReconcile().getPlugin(); + final List reconciliation = executionControl.getReconcile().getPlugins(); for ( GoalReconciliationType goalReconciliationConfig : reconciliation ) { @@ -249,7 +250,7 @@ public List getLoggedProperties( MojoExecution mojoExecution ) final GoalReconciliationType reconciliationConfig = findReconciliationConfig( mojoExecution ); if ( reconciliationConfig != null ) { - return reconciliationConfig.getLog(); + return reconciliationConfig.getLogs(); } else { @@ -265,7 +266,7 @@ public List getNologProperties( MojoExecution mojoExecution ) final GoalReconciliationType reconciliationConfig = findReconciliationConfig( mojoExecution ); if ( reconciliationConfig != null ) { - return reconciliationConfig.getNolog(); + return reconciliationConfig.getNologs(); } else { @@ -282,7 +283,7 @@ public List getEffectivePomExcludeProperties( Plugin plugin ) if ( pluginConfig != null && pluginConfig.getEffectivePom() != null ) { - return pluginConfig.getEffectivePom().getExcludeProperty(); + return pluginConfig.getEffectivePom().getExcludeProperties(); } return Collections.emptyList(); } @@ -295,7 +296,7 @@ private PluginConfigurationScanType findPluginScanConfig( Plugin plugin ) return null; } - final List pluginConfigs = cacheConfig.getInput().getPlugin(); + final List pluginConfigs = cacheConfig.getInput().getPlugins(); for ( PluginConfigurationScanType pluginConfig : pluginConfigs ) { if ( isPluginMatch( plugin, pluginConfig ) ) @@ -338,7 +339,7 @@ public PluginScanConfig getExecutionDirScanConfig( Plugin plugin, PluginExecutio if ( pluginScanConfig != null ) { final ExecutionConfigurationScanType executionScanConfig = findExecutionScanConfig( exec, - pluginScanConfig.getExecution() ); + pluginScanConfig.getExecutions() ); if ( executionScanConfig != null && executionScanConfig.getDirScan() != null ) { return new PluginScanConfigImpl( executionScanConfig.getDirScan() ); @@ -353,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; } @@ -380,15 +381,15 @@ public String getDefaultGlob() 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 @@ -439,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 ) ) @@ -448,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; @@ -536,7 +537,7 @@ public List getAttachedOutputs() { checkInitializedState(); final AttachedOutputs attachedOutputs = getConfiguration().getAttachedOutputs(); - return attachedOutputs == null ? Collections.emptyList() : attachedOutputs.getDirName(); + return attachedOutputs == null ? Collections.emptyList() : attachedOutputs.getDirNames(); } @Nonnull @@ -552,7 +553,7 @@ private List compileExcludePatterns() 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 ) ); } 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 f63ffe6c9cb5..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 @@ -38,6 +38,7 @@ import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; +import java.io.InputStream; import java.nio.file.Files; /** @@ -85,47 +86,33 @@ public byte[] toBytes( CacheReportType cacheReportType ) throws IOException public T fromFile( Class clazz, File file ) throws IOException, XmlPullParserException { - if ( clazz == BuildInfoType.class ) - { - return clazz.cast( new CacheDomainXpp3Reader().read( Files.newInputStream( file.toPath() ) ) ); - } - else if ( clazz == CacheType.class ) - { - return clazz.cast( new CacheConfigXpp3Reader().read( Files.newInputStream( file.toPath() ) ) ); - } - else if ( clazz == BuildDiffType.class ) - { - return clazz.cast( new CacheDiffXpp3Reader().read( Files.newInputStream( file.toPath() ) ) ); - } - else if ( clazz == CacheReportType.class ) - { - return clazz.cast( new CacheReportXpp3Reader().read( Files.newInputStream( file.toPath() ) ) ); - } - else - { - throw new IllegalArgumentException( "Unsupported type " + clazz ); - } + 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 { if ( clazz == BuildInfoType.class ) { - return clazz.cast( new CacheDomainXpp3Reader().read( new ByteArrayInputStream( bytes ) ) ); + return clazz.cast( new CacheDomainXpp3Reader().read( inputStream ) ); } else if ( clazz == CacheType.class ) { - return clazz.cast( new CacheConfigXpp3Reader().read( new ByteArrayInputStream( bytes ) ) ); + return clazz.cast( new CacheConfigXpp3Reader().read( inputStream ) ); } else if ( clazz == BuildDiffType.class ) { - return clazz.cast( new CacheDiffXpp3Reader().read( new ByteArrayInputStream( bytes ) ) ); + return clazz.cast( new CacheDiffXpp3Reader().read( inputStream ) ); } else if ( clazz == CacheReportType.class ) { - return clazz.cast( new CacheReportXpp3Reader().read( new ByteArrayInputStream( bytes ) ) ); + return clazz.cast( new CacheReportXpp3Reader().read( inputStream ) ); } else { diff --git a/maven-core/src/main/mdo/cache-config.mdo b/maven-core/src/main/mdo/cache-config.mdo index dfd4bf651863..5160bb88a6db 100644 --- a/maven-core/src/main/mdo/cache-config.mdo +++ b/maven-core/src/main/mdo/cache-config.mdo @@ -76,7 +76,7 @@ under the License. --> - + CacheType @@ -320,7 +320,7 @@ under the License. - debug + debugs String * @@ -376,7 +376,7 @@ under the License. AttachedOutputs - dirName + dirNames String * @@ -445,7 +445,7 @@ under the License. Global input calculation rules applicable to all projects and plugins in the build - plugin + plugins PluginConfigurationScanType * @@ -520,7 +520,7 @@ under the License. Specifies plugin level rules of configuration processing in search of referenced source files - execution + executions ExecutionConfigurationScanType * @@ -548,7 +548,7 @@ under the License. EffectivePom - excludeProperty + excludeProperties String * @@ -583,7 +583,7 @@ under the License. ExecutionConfigurationScanType - execId + execIds String * @@ -694,7 +694,7 @@ under the License. DirScanConfigType - include + includes TagScanConfigType * @@ -703,7 +703,7 @@ under the License. properties will be takein in calculation (whitelist) - exclude + excludes TagNameType * @@ -711,7 +711,7 @@ under the License. Tag to exclude when scanning plugin configuration for input files (blacklist) - tagScanConfig + tagScanConfigs TagScanConfigType * @@ -769,7 +769,7 @@ under the License. OutputTypeExclude - pattern + patterns String * @@ -804,21 +804,30 @@ under the License. * - include + includes Include * - exclude + excludes - String + Exclude * + + Exclude + + + value + String + + + Include @@ -901,14 +910,14 @@ under the License. GoalIdType - reconcile + reconciles TrackedPropertyType * - log + logs PropertyNameType * @@ -916,7 +925,7 @@ under the License. Specify property which should be logged to build metadata for exploration - nolog + nologs PropertyNameType * @@ -1057,7 +1066,7 @@ under the License. Reconcile - plugin + plugins GoalReconciliationType * @@ -1113,7 +1122,7 @@ under the License. ExecutablesType - plugin + plugins PluginSetType * @@ -1121,7 +1130,7 @@ under the License. Specify which executions should run always if present in build regardless of cached status - execution + executions ExecutionIdsListType * @@ -1129,7 +1138,7 @@ under the License. Specify which executions should run always if present in build regardless of cached status - goals + goalsLists GoalsListType * @@ -1162,7 +1171,7 @@ under the License. CoordinatesBaseType - goal + goals String * @@ -1217,7 +1226,7 @@ under the License. CoordinatesBaseType - execId + execIds String * @@ -1250,11 +1259,11 @@ under the License. CoordinatesBaseType - + groupId String - + artifactId String @@ -1274,7 +1283,7 @@ under the License. TagNameType - + tagName String true diff --git a/maven-core/src/main/mdo/cache-diff.mdo b/maven-core/src/main/mdo/cache-diff.mdo index e2a9cfec34c9..d9c3d182ed1e 100644 --- a/maven-core/src/main/mdo/cache-diff.mdo +++ b/maven-core/src/main/mdo/cache-diff.mdo @@ -19,7 +19,7 @@ under the License. + xsd.namespace="org:apache:maven:cache:diff"> cache-diff CacheDiff + xsd.namespace="org:apache:maven:cache:report"> cache-report CacheReport - - - - - - - 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 - - - - - - - - - .*-processes.*\.zip - - - - - - - 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/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 + + + + + + + + + + + + + + + .*-processes.*\.zip + + + + + + + + + + + + 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 From 896eeb9c6ae1e78e6bcc8bfdfe0c843e646e562f Mon Sep 17 00:00:00 2001 From: Guillaume Nodet Date: Fri, 5 Nov 2021 15:21:05 +0100 Subject: [PATCH 4/8] [MNG-7324] Allow more minimal config --- .../main/java/org/apache/maven/caching/xml/CacheConfigImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 137bcc669de4..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 @@ -399,7 +399,7 @@ public MultimoduleDiscoveryStrategy getMultimoduleDiscoveryStrategy() checkInitializedState(); final ProjectDiscoveryStrategy projectDiscoveryStrategy = cacheConfig.getConfiguration().getProjectDiscoveryStrategy(); - if ( projectDiscoveryStrategy.getSpecificVersion() != null ) + if ( projectDiscoveryStrategy != null && projectDiscoveryStrategy.getSpecificVersion() != null ) { return new SentinelVersionStartegy( projectDiscoveryStrategy.getSpecificVersion() ); } From 71596914c26fa7d16d72688e3ef510785fdaf7e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Sat, 6 Nov 2021 18:39:53 +0100 Subject: [PATCH 5/8] [MNG-7324] remove now unused JAXB dependencies --- .../appended-resources/META-INF/LICENSE.vm | 2 -- .../appended-resources/licenses/EDL-1.0.txt | 23 ------------- maven-core/pom.xml | 33 ------------------- pom.xml | 1 - 4 files changed, 59 deletions(-) delete mode 100644 apache-maven/src/main/appended-resources/licenses/EDL-1.0.txt diff --git a/apache-maven/src/main/appended-resources/META-INF/LICENSE.vm b/apache-maven/src/main/appended-resources/META-INF/LICENSE.vm index 6ac9f31124b7..d5cba211a660 100644 --- a/apache-maven/src/main/appended-resources/META-INF/LICENSE.vm +++ b/apache-maven/src/main/appended-resources/META-INF/LICENSE.vm @@ -42,8 +42,6 @@ subject to the terms and conditions of the following licenses: #* *##set ( $spdx = 'EPL-1.0' ) #* *##elseif ( $license.url.contains( "www.apache.org/licenses/LICENSE-2.0" ) ) #* *##set ( $spdx = 'ASL-2.0' ) -#* *##elseif ( $license.url.contains( "www.eclipse.org/org/documents/edl-v10.php" ) ) -#* *##set ( $spdx = 'EDL-1.0' ) #* *##elseif ( $license.url.contains( "www.mozilla.org/en-US/MPL/1.1" ) ) #* *##set ( $spdx = 'MPL-1.1' ) #* *##elseif ( $license.url.contains( "www.gnu.org/licenses/gpl" ) ) diff --git a/apache-maven/src/main/appended-resources/licenses/EDL-1.0.txt b/apache-maven/src/main/appended-resources/licenses/EDL-1.0.txt deleted file mode 100644 index 259e0377f30f..000000000000 --- a/apache-maven/src/main/appended-resources/licenses/EDL-1.0.txt +++ /dev/null @@ -1,23 +0,0 @@ -Eclipse Distribution License - v 1.0 -Copyright (c) 2007, Eclipse Foundation, Inc. and its licensors. - -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided -that the following conditions are met: - -- Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. -- Redistributions in binary form must reproduce the above copyright notice, -this list of conditions and the following disclaimer in the documentation and/or other materials provided -with the distribution. -- Neither the name of the Eclipse Foundation, Inc. nor the names of its contributors may be used to endorse -or promote products derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, -INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/maven-core/pom.xml b/maven-core/pom.xml index 5ff2215e2420..c3c3c7cb32fc 100644 --- a/maven-core/pom.xml +++ b/maven-core/pom.xml @@ -156,17 +156,6 @@ under the License. zero-allocation-hashing 0.9 - - jakarta.xml.bind - jakarta.xml.bind-api - 2.3.3 - - - com.sun.xml.bind - jaxb-impl - 2.3.3 - runtime - com.github.albfernandez juniversalchardet @@ -281,28 +270,6 @@ under the License. - diff --git a/pom.xml b/pom.xml index f76757ba9fc6..bfadcb6ee4a8 100644 --- a/pom.xml +++ b/pom.xml @@ -555,7 +555,6 @@ under the License. --> src/main/appended-resources/licenses/CDDL-1.0.txt src/main/appended-resources/licenses/EPL-1.0.txt - src/main/appended-resources/licenses/EDL-1.0.txt src/main/appended-resources/licenses/MPL-1.1.txt src/main/appended-resources/licenses/LGPL-3.0.txt .editorconfig From b9985c817386f2c6bea5d68d2e84c854ed55bc52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Mon, 8 Nov 2021 21:43:03 +0100 Subject: [PATCH 6/8] [MNG-7324] update documentation --- Documentation/CACHE-HOWTO.md | 19 +++++----- Documentation/CACHE-PARAMETERS.md | 4 +-- Documentation/CACHE-REMOTE.md | 8 ++--- Documentation/CACHE.md | 44 ++++++++++++------------ Documentation/maven-cache-config.xml | 5 ++- maven-core/src/main/mdo/cache-config.mdo | 2 ++ maven-core/src/main/mdo/cache-domain.mdo | 4 ++- 7 files changed, 44 insertions(+), 42 deletions(-) diff --git a/Documentation/CACHE-HOWTO.md b/Documentation/CACHE-HOWTO.md index aa15f626af65..77d03ba07f19 100644 --- a/Documentation/CACHE-HOWTO.md +++ b/Documentation/CACHE-HOWTO.md @@ -17,18 +17,17 @@ ### Overview -Cache configuration provides you additional control over incremental maven behavior. Follow it step by step to +Cache configuration provides you additional control over incremental Maven behavior. Follow it step by step to understand how it works and figure out your optimal config ### Minimal config -Absolutely minimal config which enables incremental maven with local cache +Absolutely minimal config which enables incremental Maven with local cache ```xml - + true @@ -73,7 +72,7 @@ Add all the project specific source code files in ``. Scala in this case: ### Adding source directory for bespoke project layouts -In most of the cases incremental maven will recognize directories automatically by build introspection. If not, you can +In most of the cases incremental Maven will recognize directories automatically by build introspection. If not, you can add additional directories with ``. Also you can filter out undesirable dirs and files by using exclude tag ```xml @@ -134,7 +133,7 @@ Add `executionControl/runAlways` section ```xml + xsi:schemaLocation="org:apache:maven:cache:config:v1 http://maven.apache.org/xsd/cache-config-1.0.0.xsd"> ... @@ -157,7 +156,7 @@ Add `executionControl/runAlways` section ### I occasionally cached build with `-DskipTests=true` and tests do not run now -If you add command line flags to your build, they do not participate in effective pom - maven defers final value +If you add command line flags to your build, they do not participate in effective pom - Maven defers final value resolution to plugin runtime. To invalidate build if filed value is different in runtime, add reconciliation section to `executionControl`: @@ -180,7 +179,7 @@ to `executionControl`: Please notice `skipValue` attribute. It denotes value which forces skipped execution. Read `propertyName="skipTests" skipValue="true"` as if property skipTests has value true, plugin will skip execution If -you declare such value incremental maven will reuse appropriate full-build though technically they are different, but +you declare such value incremental Maven will reuse appropriate full-build though technically they are different, but because full-build is better it is safe to reuse ### How to renormalize line endings in working copy after committing .gitattributes (git 2.16+) @@ -201,4 +200,4 @@ git reset --hard ### I want to cache interim build and override it later with final version Solution: set `-Dremote.cache.save.final=true` to nodes which produce final builds. Such builds will not be overridden -and eventually will replace all interim builds \ No newline at end of file +and eventually will replace all interim builds diff --git a/Documentation/CACHE-PARAMETERS.md b/Documentation/CACHE-PARAMETERS.md index 7633ddbea158..12042c634076 100644 --- a/Documentation/CACHE-PARAMETERS.md +++ b/Documentation/CACHE-PARAMETERS.md @@ -26,8 +26,8 @@ This documents contains various configuration parameters supported by cache engi | `-Dremote.cache.configPath=true/false` | Location of cache configuration file | Cache config is not in default location | | `-Dremote.cache.enabled=true/false` | Remote cache and associated features disabled/enabled | To remove noise from logs then remote cache is not available | | `-Dremote.cache.save.enabled=true/false` | Remote cache save allowed or not | To designate nodes which allowed to push in remote shared cache | -| `-Dremote.cache.save.final=true/false` | Is it allowed or not to override produced cache | To ensure that reference build is not overriden by interim build | -| `-Dremote.cache.failFast=true/false` | Fail on the first module whcih cannot be restored from cache | Remote cache setup/tuning/troubleshooting | +| `-Dremote.cache.save.final=true/false` | Is it allowed or not to override produced cache | To ensure that reference build is not overridden by interim build | +| `-Dremote.cache.failFast=true/false` | Fail on the first module which cannot be restored from cache | Remote cache setup/tuning/troubleshooting | | `-Dremote.cache.baselineUrl=` | Location of baseline build for comparison | Remote cache setup/tuning/troubleshooting | ## Project level properties diff --git a/Documentation/CACHE-REMOTE.md b/Documentation/CACHE-REMOTE.md index f5fe38721d70..c89e5de19818 100644 --- a/Documentation/CACHE-REMOTE.md +++ b/Documentation/CACHE-REMOTE.md @@ -17,7 +17,7 @@ # Overview -This document describes generic approach to cache setup. The process require expertise in maven equivalent to expertise +This document describes generic approach to cache setup. The process require expertise in Maven equivalent to expertise required to author and Maven your project build, it implies good knowledge of both Maven and the project. Due to Maven model limitation the process is manual, but allows you to achieve sufficient control and transparency over caching logic. @@ -113,8 +113,8 @@ Once discrepancy between remote and local builds detected cache will fail with d in `target/incremental-maven` directory: ``` -* buildinfo-baseline-3c64673e23259e6f.xml - build specficiation from baseline build -* buildinfo-db43936e0666ce7.xml - build specification of locall build +* buildinfo-baseline-3c64673e23259e6f.xml - build specification from baseline build +* buildinfo-db43936e0666ce7.xml - build specification of local build * buildsdiff.xml - comparison report with list of discrepancies ``` @@ -242,7 +242,7 @@ relax consistency rules in favor of compatibility, remove property from tracked Current implementation doesn't support version changes between cache entries. It will result in cache invalidation for each new version. -To mitigate the issue please consider migrating off traditional maven release approach - try to use single version id in +To mitigate the issue please consider migrating off traditional Maven release approach - try to use single version id in project (eg `MY-PROJECT-LOCAL`). Such approach simplifies git branching workflow significantly. Deployment of artifacts with specific version from builds with cache is not supported yet. diff --git a/Documentation/CACHE.md b/Documentation/CACHE.md index 391becc7b5f7..7449ef5cc7ec 100644 --- a/Documentation/CACHE.md +++ b/Documentation/CACHE.md @@ -17,19 +17,19 @@ ## Overview -Idea of Incremental Maven is to specify module inputs and outputs and make them known to standard maven core. This +Idea of Incremental Maven is to specify module inputs and outputs and make them known to standard Maven core. This allows accurate analysis and determination of out-of-date build artifacts in the build dependencies graph. Making the dependency graph analysis deterministic leads to improvements in build times by avoiding re-building unnecessary modules. -Cache does not make any low-level interventions to build process and delegates actual build work to maven core. This -guarantees that build results are identical to results produced by standard maven and are fully reproducible. -To achieve accurate input and outputs calculation incremental maven combines automatic introspection +Cache does not make any low-level interventions to build process and delegates actual build work to Maven core. This +guarantees that build results are identical to results produced by standard Maven and are fully reproducible. +To achieve accurate input and outputs calculation incremental Maven combines automatic introspection of [project object model](https://maven.apache.org/pom.html#What_is_the_POM) in conjunction with configuration-driven rules for fine-grained content and execution control. For content analysis it digests based approach which is more reliable over widely used file timestamps in tools like Make or Apache Ant. Deterministic build state allows reliably cache even intermediate outputs of build and share them between teams using remote cache. Deterministic inputs calculation allows distributed and parallel builds running in heterogeneous environments (like cloud of build agents) -could efficiently reuse cached build artifacts. Therefore incremental maven is particularly well-suited for large maven +could efficiently reuse cached build artifacts. Therefore incremental Maven is particularly well-suited for large Maven projects that have significant number of small modules. Remote cache in conjunction with precise input identification effectively enables "change once - build once" approach. @@ -51,7 +51,7 @@ of today build with some tolerance (implementation, configuration and environmen ### Implementation insights -At very simple form, the incremental maven is essentially a hash function which takes maven project and produces hash +At very simple form, the incremental Maven is essentially a hash function which takes Maven project and produces hash code (checksum). Then hash value is used to fetch and restore build result. As with any hash, there could be collisions and instabilities. Collision could happen if the same hash produced from the different build states and will result in unintended reuse. Instability means that same input yields different hash sums @@ -79,7 +79,7 @@ verification it's still consumer's responsibility to verify final product qualit Given all the information above, the Incremental Maven is recommended to use in scenarios when productivity and performance are in priority. Typical cases are: -* Speedup CI. In conjunction with remote cache incremental maven could drastically reduce build times, validate pull +* Speedup CI. In conjunction with remote cache incremental Maven could drastically reduce build times, validate pull requests faster and reduce load on CI nodes * Speedup developer builds. By reusing cached builds developers could verify changes much faster and be more productive. No more `-DskipTests` and similar. @@ -92,35 +92,35 @@ This also allows you to validate cache correctness and reconcile cache outcomes ## Getting Started -To on-board incremental maven you need to complete several steps: +To on-board incremental Maven you need to complete several steps: -* Get incremental maven distribution -* Add cache config in .mvn +* Get incremental Maven distribution +* Add cache config in `.mvn` * Validate build results and iteratively adjust config to project specifics -* Migrate CI to incremental maven with remote cache (to get full benefit) - optional +* Migrate CI to incremental Maven with remote cache (to get full benefit) - optional -### Get incremental maven distribution +### Get incremental Maven distribution The recommended way is to add [Takari Maven Wrapper](https://github.com/takari/maven-wrapper) to your project. In that -case `maven-wrapper.properties` should reference the latest incremental maven distribution: +case `maven-wrapper.properties` should reference the latest incremental Maven distribution: ```properties distributionUrl=https://your-server/maven-incremental.zip wrapperUrl=https://your-server/maven-wrapper-0.5.5.jar ``` -Benefits of using maven wrapper are following: +Benefits of using Maven wrapper are following: * simple distribution across workstations and CI envs -* maven stays compatible to your branch +* Maven stays compatible to your branch * further upgrades are simplified significantly - If you refuse wrapper - then download, unzip and install it just as usual maven. Further it will be assumed you use - maven wrapper (`mvnw`) + If you refuse wrapper - then download, unzip and install it just as usual Maven. Further it will be assumed you use + Maven wrapper (`mvnw`) ### Adding cache config -Copy [default config](maven-cache-config.xml) and [xml schema](../maven-core/src/main/resources/cache-config.xsd) -to [.mvn](https://maven.apache.org/configure.html) dir of yor project. +Copy [default config `maven-cache-config.xml`](maven-cache-config.xml) +to [`.mvn/`](https://maven.apache.org/configure.html) dir of your project. To get overall understanding of cache machinery it is recommended to review the config and read comments. In typical scenario you need to adjust: @@ -135,15 +135,15 @@ See also: * [Remote cache setup](CACHE-REMOTE.md) - instruction how to setup shared cache * [Cache How-To](CACHE-HOWTO.md) - cookbook for frequently encountered questions * [Cache Parameters](CACHE-PARAMETERS.md) - description of supported parameters -* Attached [sample config file](maven-cache-config.xml) and elements annotations in xsd schema. (Ctrl+Q in idea should +* Attached [sample `maven-cache-config.xml` config file](maven-cache-config.xml) and elements annotations in xsd schema. (Ctrl+Q in idea should show annotations in popup) ### Adjusting cache config -Having incremental maven and the config in place you're all set. To run first cacheable build just +Having incremental Maven and the config in place you're all set. To run first cacheable build just execute: `mvnw clean install` -* Ensure that the config is picked up and incremental maven is picked up. Just check log output - you will notice cache +* Ensure that the config is picked up and incremental Maven is picked up. Just check log output - you will notice cache related output or initialization error message. * Navigate to your local repo directory - there should be sibling next to your local repo named `cache` * Find `buildinfo.xml` for typical module and review it. Ensure that diff --git a/Documentation/maven-cache-config.xml b/Documentation/maven-cache-config.xml index a2a7ad8ee1c3..12425fdf8939 100644 --- a/Documentation/maven-cache-config.xml +++ b/Documentation/maven-cache-config.xml @@ -15,9 +15,8 @@ See the License for the specific language governing permissions and limitations under the License. --> - + true diff --git a/maven-core/src/main/mdo/cache-config.mdo b/maven-core/src/main/mdo/cache-config.mdo index 5160bb88a6db..99cbec071149 100644 --- a/maven-core/src/main/mdo/cache-config.mdo +++ b/maven-core/src/main/mdo/cache-config.mdo @@ -19,6 +19,8 @@ under the License. cache-config CacheConfig diff --git a/maven-core/src/main/mdo/cache-domain.mdo b/maven-core/src/main/mdo/cache-domain.mdo index 43c353041ba8..44ccdd67ca6d 100644 --- a/maven-core/src/main/mdo/cache-domain.mdo +++ b/maven-core/src/main/mdo/cache-domain.mdo @@ -19,6 +19,8 @@ under the License. cache-domain CacheDomain @@ -35,7 +37,7 @@ under the License. BuildInfoType 1.0.0+ - extension.xml file.]]> + From 6047eda970c72b752c183d9dc6f303d0975fac8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Mon, 8 Nov 2021 22:02:06 +0100 Subject: [PATCH 7/8] [MNG-7324] split config/domain/diff/report to separate xml.* packages --- maven-core/pom.xml | 3 ++ .../maven/caching/ArtifactsRepository.java | 2 +- .../apache/maven/caching/CacheContext.java | 2 +- .../maven/caching/CacheControllerImpl.java | 20 +++++----- .../org/apache/maven/caching/CacheDiff.java | 14 +++---- .../caching/DefaultPluginScanConfig.java | 2 +- .../maven/caching/HttpRepositoryImpl.java | 8 ++-- .../caching/LocalArtifactsRepository.java | 2 +- .../maven/caching/LocalRepositoryImpl.java | 8 ++-- .../maven/caching/MojoExecutionManager.java | 4 +- .../maven/caching/PluginScanConfig.java | 2 +- .../maven/caching/PluginScanConfigImpl.java | 6 +-- .../apache/maven/caching/ProjectUtils.java | 2 +- .../caching/RemoteArtifactsRepository.java | 2 +- .../maven/caching/checksum/DigestUtils.java | 2 +- .../maven/caching/checksum/KeyUtils.java | 2 +- .../caching/checksum/MavenProjectInput.java | 11 +++--- .../apache/maven/caching/xml/BuildInfo.java | 10 ++--- .../apache/maven/caching/xml/CacheConfig.java | 8 ++-- .../maven/caching/xml/CacheConfigImpl.java | 38 +++++++++---------- .../apache/maven/caching/xml/DtoUtils.java | 10 ++--- .../apache/maven/caching/xml/XmlService.java | 24 ++++++------ maven-core/src/main/mdo/cache-config.mdo | 4 +- maven-core/src/main/mdo/cache-diff.mdo | 2 +- maven-core/src/main/mdo/cache-domain.mdo | 2 +- maven-core/src/main/mdo/cache-report.mdo | 2 +- .../apache/maven/caching/BuildInfoTest.java | 13 +++---- .../maven/caching/xml/CacheConfigTest.java | 4 +- 28 files changed, 104 insertions(+), 105 deletions(-) diff --git a/maven-core/pom.xml b/maven-core/pom.xml index c3c3c7cb32fc..b82ef03c9617 100644 --- a/maven-core/pom.xml +++ b/maven-core/pom.xml @@ -215,7 +215,10 @@ under the License. 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 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 968bae24b759..c72781d35407 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.domain.CacheReportType; +import org.apache.maven.caching.xml.report.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 49b552ea8742..39ed14cac74e 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.domain.ProjectsInputInfoType; +import org.apache.maven.caching.xml.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 05e56a5b9828..7d2137243260 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.xml.config.PropertyNameType; +import org.apache.maven.caching.xml.config.TrackedPropertyType; +import org.apache.maven.caching.xml.diff.BuildDiffType; +import org.apache.maven.caching.xml.domain.ArtifactType; +import org.apache.maven.caching.xml.domain.CompletedExecutionType; +import org.apache.maven.caching.xml.domain.DigestItemType; +import org.apache.maven.caching.xml.domain.ProjectsInputInfoType; +import org.apache.maven.caching.xml.domain.Scm; +import org.apache.maven.caching.xml.report.CacheReportType; +import org.apache.maven.caching.xml.report.ProjectReportType; import org.apache.maven.caching.hash.HashAlgorithm; import org.apache.maven.caching.hash.HashFactory; -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; 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 5808e1807426..a37872bed00e 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.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.diff.BuildDiffType; +import org.apache.maven.caching.xml.diff.MismatchType; +import org.apache.maven.caching.xml.domain.BuildInfoType; +import org.apache.maven.caching.xml.domain.CompletedExecutionType; +import org.apache.maven.caching.xml.domain.DigestItemType; +import org.apache.maven.caching.xml.domain.ProjectsInputInfoType; +import org.apache.maven.caching.xml.domain.PropertyValueType; import org.apache.maven.caching.xml.CacheConfig; import java.util.ArrayList; 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 8229435ce65d..cff0375d3d1a 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.domain.DirScanConfigType; +import org.apache.maven.caching.xml.config.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 6747532bff42..09b5187b1da6 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.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.domain.ArtifactType; +import org.apache.maven.caching.xml.domain.BuildInfoType; +import org.apache.maven.caching.xml.report.CacheReportType; +import org.apache.maven.caching.xml.report.ProjectReportType; import org.apache.maven.caching.xml.BuildInfo; import org.apache.maven.caching.xml.CacheConfig; import org.apache.maven.caching.xml.CacheSource; 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 280c2be5943c..8e9cb93b2dcc 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,9 +20,9 @@ */ import com.google.common.base.Optional; -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.caching.xml.domain.ArtifactType; import org.apache.maven.execution.MavenSession; import org.apache.maven.model.Dependency; 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 78d1d1ac994d..df7385fb04e5 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,14 +31,14 @@ import org.apache.commons.io.FileUtils; import org.apache.commons.lang3.tuple.Pair; import org.apache.maven.artifact.Artifact; -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; import org.apache.maven.caching.xml.XmlService; +import org.apache.maven.caching.xml.domain.ArtifactType; +import org.apache.maven.caching.xml.domain.BuildInfoType; +import org.apache.maven.caching.xml.domain.Scm; +import org.apache.maven.caching.xml.report.CacheReportType; import org.apache.maven.execution.MavenSession; import org.apache.maven.model.Dependency; import org.apache.maven.plugin.LegacySupport; 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 a6e193695b30..8d0daa843bbf 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,11 +20,11 @@ */ import org.apache.commons.lang3.StringUtils; -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; +import org.apache.maven.caching.xml.config.TrackedPropertyType; +import org.apache.maven.caching.xml.domain.CompletedExecutionType; import org.apache.maven.execution.MavenSession; import org.apache.maven.plugin.Mojo; import org.apache.maven.plugin.MojoCheker; 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 a3af7b6cda96..08ea117a4cb7 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.domain.DirScanConfigType; +import org.apache.maven.caching.xml.config.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 1c5ea657ed0d..c7031fa3f866 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.domain.DirScanConfigType; -import org.apache.maven.caching.domain.TagNameType; -import org.apache.maven.caching.domain.TagScanConfigType; +import org.apache.maven.caching.xml.config.DirScanConfigType; +import org.apache.maven.caching.xml.config.TagNameType; +import org.apache.maven.caching.xml.config.TagScanConfigType; import javax.annotation.Nonnull; import java.util.List; 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 dbf9251ea61a..c3ea8643051f 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.domain.Scm; +import org.apache.maven.caching.xml.domain.Scm; import org.apache.maven.execution.MavenSession; import org.apache.maven.lifecycle.internal.ProjectIndex; import org.apache.maven.lifecycle.internal.builder.BuilderCommon; 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 826faf38ab8a..0112f79ff2d6 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,8 +20,8 @@ */ import com.google.common.base.Optional; -import org.apache.maven.caching.domain.ArtifactType; import org.apache.maven.caching.xml.BuildInfo; +import org.apache.maven.caching.xml.domain.ArtifactType; import org.apache.maven.project.MavenProject; import java.io.IOException; 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 0a156e2296a9..94fad20b1b3f 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.domain.DigestItemType; +import org.apache.maven.caching.xml.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 90da23e90f6d..355670c3b83e 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.domain.ArtifactType; +import org.apache.maven.caching.xml.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 56fbaedbdd26..1e5b56ab821c 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 @@ -19,7 +19,6 @@ * under the License. */ - import com.google.common.base.Optional; import com.google.common.collect.Iterables; import org.apache.commons.lang3.StringUtils; @@ -33,16 +32,16 @@ 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.HashFactory; 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.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; +import org.apache.maven.caching.xml.config.Exclude; +import org.apache.maven.caching.xml.config.Include; +import org.apache.maven.caching.xml.domain.DigestItemType; +import org.apache.maven.caching.xml.domain.ProjectsInputInfoType; import org.apache.maven.execution.MavenSession; import org.apache.maven.lifecycle.internal.ProjectIndex; import org.apache.maven.model.Build; 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 452811e6f79c..45cd1a708fcb 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,11 +24,11 @@ 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.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.xml.domain.ArtifactType; +import org.apache.maven.caching.xml.domain.BuildInfoType; +import org.apache.maven.caching.xml.domain.CompletedExecutionType; +import org.apache.maven.caching.xml.domain.DigestItemType; +import org.apache.maven.caching.xml.domain.ProjectsInputInfoType; import org.apache.maven.model.Dependency; import org.apache.maven.plugin.MojoExecution; import org.codehaus.plexus.logging.Logger; 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 a9dd950652eb..7d90cc1fea73 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,11 +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.domain.Include; -import org.apache.maven.caching.domain.PropertyNameType; -import org.apache.maven.caching.domain.TrackedPropertyType; +import org.apache.maven.caching.xml.config.Exclude; +import org.apache.maven.caching.xml.config.Include; +import org.apache.maven.caching.xml.config.PropertyNameType; +import org.apache.maven.caching.xml.config.TrackedPropertyType; import org.apache.maven.execution.MavenSession; import org.apache.maven.model.Plugin; import org.apache.maven.model.PluginExecution; 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 df8eb26003fe..398ef511dd0a 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,26 +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.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.caching.xml.config.AttachedOutputs; +import org.apache.maven.caching.xml.config.Exclude; +import org.apache.maven.caching.xml.config.Include; +import org.apache.maven.caching.xml.config.Local; +import org.apache.maven.caching.xml.config.ProjectDiscoveryStrategy; +import org.apache.maven.caching.xml.config.Remote; +import org.apache.maven.caching.xml.config.CacheType; +import org.apache.maven.caching.xml.config.ConfigurationType; +import org.apache.maven.caching.xml.config.CoordinatesBaseType; +import org.apache.maven.caching.xml.config.ExecutablesType; +import org.apache.maven.caching.xml.config.ExecutionConfigurationScanType; +import org.apache.maven.caching.xml.config.ExecutionControlType; +import org.apache.maven.caching.xml.config.ExecutionIdsListType; +import org.apache.maven.caching.xml.config.GoalReconciliationType; +import org.apache.maven.caching.xml.config.GoalsListType; +import org.apache.maven.caching.xml.config.PluginConfigurationScanType; +import org.apache.maven.caching.xml.config.PluginSetType; +import org.apache.maven.caching.xml.config.PropertyNameType; +import org.apache.maven.caching.xml.config.TrackedPropertyType; import org.apache.maven.execution.MavenSession; import org.apache.maven.model.Plugin; import org.apache.maven.model.PluginExecution; 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 7bd2d2b2dc2f..7938d9bfe99e 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,11 +23,11 @@ import org.apache.commons.lang3.StringUtils; import org.apache.maven.artifact.Artifact; import org.apache.maven.caching.ProjectUtils; -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.caching.xml.config.TrackedPropertyType; +import org.apache.maven.caching.xml.domain.ArtifactType; +import org.apache.maven.caching.xml.domain.CompletedExecutionType; +import org.apache.maven.caching.xml.domain.DigestItemType; +import org.apache.maven.caching.xml.domain.PropertyValueType; import org.apache.maven.model.Dependency; import javax.annotation.Nonnull; 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 6419c8f6ed75..5d62ecbd68a0 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,18 +19,18 @@ * under the License. */ -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.apache.maven.caching.xml.config.CacheType; +import org.apache.maven.caching.xml.config.io.xpp3.CacheConfigXpp3Reader; +import org.apache.maven.caching.xml.config.io.xpp3.CacheConfigXpp3Writer; +import org.apache.maven.caching.xml.diff.BuildDiffType; +import org.apache.maven.caching.xml.diff.io.xpp3.CacheDiffXpp3Reader; +import org.apache.maven.caching.xml.diff.io.xpp3.CacheDiffXpp3Writer; +import org.apache.maven.caching.xml.domain.BuildInfoType; +import org.apache.maven.caching.xml.domain.io.xpp3.CacheDomainXpp3Reader; +import org.apache.maven.caching.xml.domain.io.xpp3.CacheDomainXpp3Writer; +import org.apache.maven.caching.xml.report.CacheReportType; +import org.apache.maven.caching.xml.report.io.xpp3.CacheReportXpp3Reader; +import org.apache.maven.caching.xml.report.io.xpp3.CacheReportXpp3Writer; import org.codehaus.plexus.component.annotations.Component; import org.codehaus.plexus.util.xml.pull.XmlPullParserException; diff --git a/maven-core/src/main/mdo/cache-config.mdo b/maven-core/src/main/mdo/cache-config.mdo index 99cbec071149..a9e9f92bf208 100644 --- a/maven-core/src/main/mdo/cache-config.mdo +++ b/maven-core/src/main/mdo/cache-config.mdo @@ -24,13 +24,13 @@ under the License. xsd.namespace="org:apache:maven:cache:config"> cache-config CacheConfig - .mvn/maven-cache-config.xml ]]> package - org.apache.maven.caching.domain + org.apache.maven.caching.xml.config diff --git a/maven-core/src/main/mdo/cache-diff.mdo b/maven-core/src/main/mdo/cache-diff.mdo index d9c3d182ed1e..5265c54ae11a 100644 --- a/maven-core/src/main/mdo/cache-diff.mdo +++ b/maven-core/src/main/mdo/cache-diff.mdo @@ -27,7 +27,7 @@ under the License. package - org.apache.maven.caching.domain + org.apache.maven.caching.xml.diff diff --git a/maven-core/src/main/mdo/cache-domain.mdo b/maven-core/src/main/mdo/cache-domain.mdo index 44ccdd67ca6d..428f5288c11d 100644 --- a/maven-core/src/main/mdo/cache-domain.mdo +++ b/maven-core/src/main/mdo/cache-domain.mdo @@ -29,7 +29,7 @@ under the License. package - org.apache.maven.caching.domain + org.apache.maven.caching.xml.domain diff --git a/maven-core/src/main/mdo/cache-report.mdo b/maven-core/src/main/mdo/cache-report.mdo index 3e7b8f3b9a1e..474683d8d2f1 100644 --- a/maven-core/src/main/mdo/cache-report.mdo +++ b/maven-core/src/main/mdo/cache-report.mdo @@ -27,7 +27,7 @@ under the License. package - org.apache.maven.caching.domain + org.apache.maven.caching.xml.report 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 19c1de408a16..aa6708b36538 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 @@ -19,18 +19,17 @@ * under the License. */ - import com.google.common.collect.Lists; import org.apache.maven.artifact.Artifact; 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.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.domain.ArtifactType; +import org.apache.maven.caching.xml.domain.BuildInfoType; +import org.apache.maven.caching.xml.domain.CompletedExecutionType; +import org.apache.maven.caching.xml.domain.DigestItemType; +import org.apache.maven.caching.xml.domain.ProjectsInputInfoType; +import org.apache.maven.caching.xml.domain.PropertyValueType; import org.apache.maven.caching.xml.BuildInfo; import org.apache.maven.caching.xml.XmlService; import org.junit.Test; 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 c589181cf066..8b81a78dfdbc 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,12 +19,10 @@ * under the License. */ -import org.apache.maven.caching.domain.CacheType; +import org.apache.maven.caching.xml.config.CacheType; import org.junit.Test; import java.io.InputStream; -import java.nio.file.Path; -import java.nio.file.Paths; public class CacheConfigTest { From 9c57048992421eed2db3042a6165acdf012e130c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Mon, 8 Nov 2021 23:38:59 +0100 Subject: [PATCH 8/8] [MNG-7324] rename domain to buildinfo and diff to buildsdiff --- maven-core/pom.xml | 8 ++++---- .../apache/maven/caching/CacheContext.java | 2 +- .../maven/caching/CacheControllerImpl.java | 12 +++++------ .../org/apache/maven/caching/CacheDiff.java | 14 ++++++------- .../maven/caching/HttpRepositoryImpl.java | 4 ++-- .../caching/LocalArtifactsRepository.java | 2 +- .../maven/caching/LocalRepositoryImpl.java | 6 +++--- .../maven/caching/MojoExecutionManager.java | 2 +- .../apache/maven/caching/ProjectUtils.java | 2 +- .../caching/RemoteArtifactsRepository.java | 2 +- .../maven/caching/checksum/DigestUtils.java | 2 +- .../maven/caching/checksum/KeyUtils.java | 2 +- .../caching/checksum/MavenProjectInput.java | 4 ++-- .../apache/maven/caching/xml/BuildInfo.java | 10 +++++----- .../apache/maven/caching/xml/DtoUtils.java | 8 ++++---- .../apache/maven/caching/xml/XmlService.java | 20 +++++++++---------- .../{cache-domain.mdo => cache-buildinfo.mdo} | 12 +++++------ .../{cache-diff.mdo => cache-buildsdiff.mdo} | 10 +++++----- maven-core/src/main/mdo/cache-report.mdo | 2 +- .../apache/maven/caching/BuildInfoTest.java | 12 +++++------ 20 files changed, 67 insertions(+), 69 deletions(-) rename maven-core/src/main/mdo/{cache-domain.mdo => cache-buildinfo.mdo} (97%) rename maven-core/src/main/mdo/{cache-diff.mdo => cache-buildsdiff.mdo} (92%) diff --git a/maven-core/pom.xml b/maven-core/pom.xml index b82ef03c9617..93aede9be0d1 100644 --- a/maven-core/pom.xml +++ b/maven-core/pom.xml @@ -215,9 +215,9 @@ under the License. 1.0.0 + src/main/mdo/cache-buildinfo.mdo + src/main/mdo/cache-buildsdiff.mdo src/main/mdo/cache-config.mdo - src/main/mdo/cache-domain.mdo - src/main/mdo/cache-diff.mdo src/main/mdo/cache-report.mdo @@ -233,9 +233,9 @@ under the License. 1.0.0 + src/main/mdo/cache-buildinfo.mdo + src/main/mdo/cache-buildsdiff.mdo 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 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 39ed14cac74e..d485687178d0 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.xml.domain.ProjectsInputInfoType; +import org.apache.maven.caching.xml.buildinfo.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 7d2137243260..eac5feb2662a 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,14 +31,14 @@ 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.xml.buildinfo.ArtifactType; +import org.apache.maven.caching.xml.buildinfo.CompletedExecutionType; +import org.apache.maven.caching.xml.buildinfo.DigestItemType; +import org.apache.maven.caching.xml.buildinfo.ProjectsInputInfoType; +import org.apache.maven.caching.xml.buildinfo.Scm; +import org.apache.maven.caching.xml.buildsdiff.BuildDiffType; import org.apache.maven.caching.xml.config.PropertyNameType; import org.apache.maven.caching.xml.config.TrackedPropertyType; -import org.apache.maven.caching.xml.diff.BuildDiffType; -import org.apache.maven.caching.xml.domain.ArtifactType; -import org.apache.maven.caching.xml.domain.CompletedExecutionType; -import org.apache.maven.caching.xml.domain.DigestItemType; -import org.apache.maven.caching.xml.domain.ProjectsInputInfoType; -import org.apache.maven.caching.xml.domain.Scm; import org.apache.maven.caching.xml.report.CacheReportType; import org.apache.maven.caching.xml.report.ProjectReportType; import org.apache.maven.caching.hash.HashAlgorithm; 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 a37872bed00e..29e18d2fea4a 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.xml.diff.BuildDiffType; -import org.apache.maven.caching.xml.diff.MismatchType; -import org.apache.maven.caching.xml.domain.BuildInfoType; -import org.apache.maven.caching.xml.domain.CompletedExecutionType; -import org.apache.maven.caching.xml.domain.DigestItemType; -import org.apache.maven.caching.xml.domain.ProjectsInputInfoType; -import org.apache.maven.caching.xml.domain.PropertyValueType; +import org.apache.maven.caching.xml.buildinfo.BuildInfoType; +import org.apache.maven.caching.xml.buildinfo.CompletedExecutionType; +import org.apache.maven.caching.xml.buildinfo.DigestItemType; +import org.apache.maven.caching.xml.buildinfo.ProjectsInputInfoType; +import org.apache.maven.caching.xml.buildinfo.PropertyValueType; +import org.apache.maven.caching.xml.buildsdiff.BuildDiffType; +import org.apache.maven.caching.xml.buildsdiff.MismatchType; import org.apache.maven.caching.xml.CacheConfig; import java.util.ArrayList; 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 09b5187b1da6..d32460da07fd 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,8 +33,8 @@ 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.xml.domain.ArtifactType; -import org.apache.maven.caching.xml.domain.BuildInfoType; +import org.apache.maven.caching.xml.buildinfo.ArtifactType; +import org.apache.maven.caching.xml.buildinfo.BuildInfoType; import org.apache.maven.caching.xml.report.CacheReportType; import org.apache.maven.caching.xml.report.ProjectReportType; import org.apache.maven.caching.xml.BuildInfo; 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 8e9cb93b2dcc..c646aa76c0f7 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 @@ -22,7 +22,7 @@ import com.google.common.base.Optional; import org.apache.maven.caching.xml.BuildInfo; import org.apache.maven.caching.xml.CacheSource; -import org.apache.maven.caching.xml.domain.ArtifactType; +import org.apache.maven.caching.xml.buildinfo.ArtifactType; import org.apache.maven.execution.MavenSession; import org.apache.maven.model.Dependency; 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 df7385fb04e5..a0fbcbe1e528 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 @@ -35,9 +35,9 @@ import org.apache.maven.caching.xml.CacheConfig; import org.apache.maven.caching.xml.CacheSource; import org.apache.maven.caching.xml.XmlService; -import org.apache.maven.caching.xml.domain.ArtifactType; -import org.apache.maven.caching.xml.domain.BuildInfoType; -import org.apache.maven.caching.xml.domain.Scm; +import org.apache.maven.caching.xml.buildinfo.ArtifactType; +import org.apache.maven.caching.xml.buildinfo.BuildInfoType; +import org.apache.maven.caching.xml.buildinfo.Scm; import org.apache.maven.caching.xml.report.CacheReportType; import org.apache.maven.execution.MavenSession; import org.apache.maven.model.Dependency; 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 8d0daa843bbf..84efff4c5945 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 @@ -24,7 +24,7 @@ import org.apache.maven.caching.xml.CacheConfig; import org.apache.maven.caching.xml.DtoUtils; import org.apache.maven.caching.xml.config.TrackedPropertyType; -import org.apache.maven.caching.xml.domain.CompletedExecutionType; +import org.apache.maven.caching.xml.buildinfo.CompletedExecutionType; import org.apache.maven.execution.MavenSession; import org.apache.maven.plugin.Mojo; import org.apache.maven.plugin.MojoCheker; 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 c3ea8643051f..a6bdd7a6b958 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.xml.domain.Scm; +import org.apache.maven.caching.xml.buildinfo.Scm; import org.apache.maven.execution.MavenSession; import org.apache.maven.lifecycle.internal.ProjectIndex; import org.apache.maven.lifecycle.internal.builder.BuilderCommon; 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 0112f79ff2d6..551c27d0b557 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 @@ -21,7 +21,7 @@ import com.google.common.base.Optional; import org.apache.maven.caching.xml.BuildInfo; -import org.apache.maven.caching.xml.domain.ArtifactType; +import org.apache.maven.caching.xml.buildinfo.ArtifactType; import org.apache.maven.project.MavenProject; import java.io.IOException; 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 94fad20b1b3f..6973f82e9542 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.xml.domain.DigestItemType; +import org.apache.maven.caching.xml.buildinfo.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 355670c3b83e..a0075e071589 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.xml.domain.ArtifactType; +import org.apache.maven.caching.xml.buildinfo.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 1e5b56ab821c..089e02de9988 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 @@ -38,10 +38,10 @@ import org.apache.maven.caching.xml.BuildInfo; import org.apache.maven.caching.xml.CacheConfig; import org.apache.maven.caching.xml.DtoUtils; +import org.apache.maven.caching.xml.buildinfo.DigestItemType; +import org.apache.maven.caching.xml.buildinfo.ProjectsInputInfoType; import org.apache.maven.caching.xml.config.Exclude; import org.apache.maven.caching.xml.config.Include; -import org.apache.maven.caching.xml.domain.DigestItemType; -import org.apache.maven.caching.xml.domain.ProjectsInputInfoType; import org.apache.maven.execution.MavenSession; import org.apache.maven.lifecycle.internal.ProjectIndex; import org.apache.maven.model.Build; 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 45cd1a708fcb..f0cf3c7c7b6d 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,11 +24,11 @@ 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.xml.domain.ArtifactType; -import org.apache.maven.caching.xml.domain.BuildInfoType; -import org.apache.maven.caching.xml.domain.CompletedExecutionType; -import org.apache.maven.caching.xml.domain.DigestItemType; -import org.apache.maven.caching.xml.domain.ProjectsInputInfoType; +import org.apache.maven.caching.xml.buildinfo.ArtifactType; +import org.apache.maven.caching.xml.buildinfo.BuildInfoType; +import org.apache.maven.caching.xml.buildinfo.CompletedExecutionType; +import org.apache.maven.caching.xml.buildinfo.DigestItemType; +import org.apache.maven.caching.xml.buildinfo.ProjectsInputInfoType; import org.apache.maven.model.Dependency; import org.apache.maven.plugin.MojoExecution; import org.codehaus.plexus.logging.Logger; 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 7938d9bfe99e..d44ab3753584 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,11 +23,11 @@ import org.apache.commons.lang3.StringUtils; import org.apache.maven.artifact.Artifact; import org.apache.maven.caching.ProjectUtils; +import org.apache.maven.caching.xml.buildinfo.ArtifactType; +import org.apache.maven.caching.xml.buildinfo.CompletedExecutionType; +import org.apache.maven.caching.xml.buildinfo.DigestItemType; +import org.apache.maven.caching.xml.buildinfo.PropertyValueType; import org.apache.maven.caching.xml.config.TrackedPropertyType; -import org.apache.maven.caching.xml.domain.ArtifactType; -import org.apache.maven.caching.xml.domain.CompletedExecutionType; -import org.apache.maven.caching.xml.domain.DigestItemType; -import org.apache.maven.caching.xml.domain.PropertyValueType; import org.apache.maven.model.Dependency; import javax.annotation.Nonnull; 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 5d62ecbd68a0..44bd917cc7da 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 @@ -22,12 +22,12 @@ import org.apache.maven.caching.xml.config.CacheType; import org.apache.maven.caching.xml.config.io.xpp3.CacheConfigXpp3Reader; import org.apache.maven.caching.xml.config.io.xpp3.CacheConfigXpp3Writer; -import org.apache.maven.caching.xml.diff.BuildDiffType; -import org.apache.maven.caching.xml.diff.io.xpp3.CacheDiffXpp3Reader; -import org.apache.maven.caching.xml.diff.io.xpp3.CacheDiffXpp3Writer; -import org.apache.maven.caching.xml.domain.BuildInfoType; -import org.apache.maven.caching.xml.domain.io.xpp3.CacheDomainXpp3Reader; -import org.apache.maven.caching.xml.domain.io.xpp3.CacheDomainXpp3Writer; +import org.apache.maven.caching.xml.buildinfo.BuildInfoType; +import org.apache.maven.caching.xml.buildinfo.io.xpp3.CacheBuildInfoXpp3Reader; +import org.apache.maven.caching.xml.buildinfo.io.xpp3.CacheBuildInfoXpp3Writer; +import org.apache.maven.caching.xml.buildsdiff.BuildDiffType; +import org.apache.maven.caching.xml.buildsdiff.io.xpp3.CacheBuildsDiffXpp3Reader; +import org.apache.maven.caching.xml.buildsdiff.io.xpp3.CacheBuildsDiffXpp3Writer; import org.apache.maven.caching.xml.report.CacheReportType; import org.apache.maven.caching.xml.report.io.xpp3.CacheReportXpp3Reader; import org.apache.maven.caching.xml.report.io.xpp3.CacheReportXpp3Writer; @@ -61,7 +61,7 @@ public byte[] toBytes( BuildInfoType buildInfo ) throws IOException { try ( ByteArrayOutputStream baos = new ByteArrayOutputStream() ) { - new CacheDomainXpp3Writer().write( baos, buildInfo ); + new CacheBuildInfoXpp3Writer().write( baos, buildInfo ); return baos.toByteArray(); } } @@ -70,7 +70,7 @@ public byte[] toBytes( BuildDiffType diff ) throws IOException { try ( ByteArrayOutputStream baos = new ByteArrayOutputStream() ) { - new CacheDiffXpp3Writer().write( baos, diff ); + new CacheBuildsDiffXpp3Writer().write( baos, diff ); return baos.toByteArray(); } } @@ -100,7 +100,7 @@ public T fromInputStream( Class clazz, InputStream inputStream ) { if ( clazz == BuildInfoType.class ) { - return clazz.cast( new CacheDomainXpp3Reader().read( inputStream ) ); + return clazz.cast( new CacheBuildInfoXpp3Reader().read( inputStream ) ); } else if ( clazz == CacheType.class ) { @@ -108,7 +108,7 @@ else if ( clazz == CacheType.class ) } else if ( clazz == BuildDiffType.class ) { - return clazz.cast( new CacheDiffXpp3Reader().read( inputStream ) ); + return clazz.cast( new CacheBuildsDiffXpp3Reader().read( inputStream ) ); } else if ( clazz == CacheReportType.class ) { diff --git a/maven-core/src/main/mdo/cache-domain.mdo b/maven-core/src/main/mdo/cache-buildinfo.mdo similarity index 97% rename from maven-core/src/main/mdo/cache-domain.mdo rename to maven-core/src/main/mdo/cache-buildinfo.mdo index 428f5288c11d..0659d76256d1 100644 --- a/maven-core/src/main/mdo/cache-domain.mdo +++ b/maven-core/src/main/mdo/cache-buildinfo.mdo @@ -19,17 +19,15 @@ under the License. - cache-domain - CacheDomain - + cache-buildinfo + CacheBuildInfo + lookupinfo.xml or remote buildinfo.xml ]]> package - org.apache.maven.caching.xml.domain + org.apache.maven.caching.xml.buildinfo diff --git a/maven-core/src/main/mdo/cache-diff.mdo b/maven-core/src/main/mdo/cache-buildsdiff.mdo similarity index 92% rename from maven-core/src/main/mdo/cache-diff.mdo rename to maven-core/src/main/mdo/cache-buildsdiff.mdo index 5265c54ae11a..45bdfe1d0a8d 100644 --- a/maven-core/src/main/mdo/cache-diff.mdo +++ b/maven-core/src/main/mdo/cache-buildsdiff.mdo @@ -19,15 +19,15 @@ under the License. - cache-diff - CacheDiff - + cache-buildsdiff + CacheBuildsDiff + buildsdiff-${checksum}.xml ]]> package - org.apache.maven.caching.xml.diff + org.apache.maven.caching.xml.buildsdiff diff --git a/maven-core/src/main/mdo/cache-report.mdo b/maven-core/src/main/mdo/cache-report.mdo index 474683d8d2f1..fed8d24f5472 100644 --- a/maven-core/src/main/mdo/cache-report.mdo +++ b/maven-core/src/main/mdo/cache-report.mdo @@ -22,7 +22,7 @@ under the License. xsd.namespace="org:apache:maven:cache:report"> cache-report CacheReport - cache-report.xml ]]> 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 aa6708b36538..e05516884877 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 @@ -24,12 +24,12 @@ 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.xml.domain.ArtifactType; -import org.apache.maven.caching.xml.domain.BuildInfoType; -import org.apache.maven.caching.xml.domain.CompletedExecutionType; -import org.apache.maven.caching.xml.domain.DigestItemType; -import org.apache.maven.caching.xml.domain.ProjectsInputInfoType; -import org.apache.maven.caching.xml.domain.PropertyValueType; +import org.apache.maven.caching.xml.buildinfo.ArtifactType; +import org.apache.maven.caching.xml.buildinfo.BuildInfoType; +import org.apache.maven.caching.xml.buildinfo.CompletedExecutionType; +import org.apache.maven.caching.xml.buildinfo.DigestItemType; +import org.apache.maven.caching.xml.buildinfo.ProjectsInputInfoType; +import org.apache.maven.caching.xml.buildinfo.PropertyValueType; import org.apache.maven.caching.xml.BuildInfo; import org.apache.maven.caching.xml.XmlService; import org.junit.Test;