[
https://issues.apache.org/jira/browse/MNG-7945?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17790665#comment-17790665
]
ASF GitHub Bot commented on MNG-7945:
-------------------------------------
gnodet commented on code in PR #1323:
URL: https://github.com/apache/maven/pull/1323#discussion_r1408078692
##########
maven-core/src/main/java/org/apache/maven/internal/transformation/impl/TransformedArtifact.java:
##########
@@ -0,0 +1,148 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.internal.transformation.impl;
+
+import javax.xml.stream.XMLStreamException;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.util.Objects;
+import java.util.concurrent.atomic.AtomicReference;
+import java.util.function.Supplier;
+
+import org.apache.maven.artifact.DefaultArtifact;
+import org.apache.maven.internal.transformation.TransformationFailedException;
+import org.apache.maven.model.building.ModelBuildingException;
+import org.apache.maven.project.MavenProject;
+import
org.codehaus.plexus.component.repository.exception.ComponentLookupException;
+import org.eclipse.aether.RepositorySystemSession;
+
+/**
+ * Transformed artifact is derived with some transformation from source
artifact.
+ *
+ * @since TBD
+ */
+class TransformedArtifact extends DefaultArtifact {
+
+ private static final int SHA1_BUFFER_SIZE = 8192;
+ private final DefaultConsumerPomArtifactTransformer
defaultConsumerPomArtifactTransformer;
+ private final MavenProject project;
+ private final Supplier<Path> sourcePathProvider;
+ private final Path target;
+ private final RepositorySystemSession session;
+ private final AtomicReference<String> sourceState;
+
+ TransformedArtifact(
+ DefaultConsumerPomArtifactTransformer
defaultConsumerPomArtifactTransformer,
+ MavenProject project,
+ Path target,
+ RepositorySystemSession session,
+ org.apache.maven.artifact.Artifact source,
+ Supplier<Path> sourcePathProvider,
+ String classifier,
+ String extension) {
+ super(
+ source.getGroupId(),
+ source.getArtifactId(),
+ source.getVersionRange(),
+ source.getScope(),
+ extension,
+ classifier,
+ new TransformedArtifactHandler(
+ classifier, extension,
source.getArtifactHandler().getPackaging()));
+ this.defaultConsumerPomArtifactTransformer =
defaultConsumerPomArtifactTransformer;
+ this.project = project;
+ this.target = target;
+ this.session = session;
+ this.sourcePathProvider = sourcePathProvider;
+ this.sourceState = new AtomicReference<>(null);
+ }
+
+ @Override
+ public boolean isResolved() {
+ return getFile() != null;
+ }
+
+ @Override
+ public void setFile(File file) {
+ throw new IllegalStateException("transformed artifact file cannot be
set");
Review Comment:
Because the whole point of `TransformedArtifact` is to generate lazily the
file. So if a plugin tries to set a file, it would be ignored, which would
tricky to debug. Better fail early in such a case.
> Fix profile settings being injected into consumer POMs
> ------------------------------------------------------
>
> Key: MNG-7945
> URL: https://issues.apache.org/jira/browse/MNG-7945
> Project: Maven
> Issue Type: Bug
> Affects Versions: 4.0.0-alpha-8
> Reporter: Tamas Cservenak
> Assignee: Guillaume Nodet
> Priority: Major
> Fix For: 4.0.0-alpha-9
>
>
> The consumer POMs may end up containing information from user settings.
> The reason is that they are currently built from the effective POMs. They
> need to be rebuilt based on raw models.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)