[
https://issues.apache.org/jira/browse/MNG-7622?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17679799#comment-17679799
]
ASF GitHub Bot commented on MNG-7622:
-------------------------------------
cstamas commented on code in PR #907:
URL: https://github.com/apache/maven/pull/907#discussion_r1084058207
##########
maven-core/src/main/java/org/apache/maven/internal/transformation/ConsumerPomArtifactTransformer.java:
##########
@@ -0,0 +1,169 @@
+/*
+ * 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;
+
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.function.BiConsumer;
+
+import org.apache.maven.feature.Features;
+import org.apache.maven.model.building.DefaultBuildPomXMLFilterFactory;
+import org.apache.maven.model.building.TransformerContext;
+import org.apache.maven.model.transform.RawToConsumerPomXMLFilterFactory;
+import org.apache.maven.model.transform.pull.XmlUtils;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.artifact.ProjectArtifact;
+import org.codehaus.plexus.util.ReaderFactory;
+import org.codehaus.plexus.util.xml.XmlStreamReader;
+import org.codehaus.plexus.util.xml.pull.EntityReplacementMap;
+import org.codehaus.plexus.util.xml.pull.MXParser;
+import org.codehaus.plexus.util.xml.pull.XmlPullParser;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+import org.eclipse.aether.RepositorySystemSession;
+import org.eclipse.aether.artifact.Artifact;
+import org.eclipse.aether.artifact.DefaultArtifact;
+import org.eclipse.aether.deployment.DeployRequest;
+import org.eclipse.aether.installation.InstallRequest;
+
+/**
+ * Consumer POM transformer.
+ *
+ * @since TBD
+ */
+@Singleton
+@Named("consumer-pom")
+public final class ConsumerPomArtifactTransformer {
+
+ private static final String CONSUMER_POM_CLASSIFIER = "maven-consumer-pom";
+
+ public void injectTransformedArtifacts(MavenProject project,
RepositorySystemSession session) throws IOException {
+ if (isActive(session)) {
+ Path generatedFile;
+ String buildDirectory =
+ project.getBuild() != null ?
project.getBuild().getDirectory() : null;
+ if (buildDirectory == null) {
+ generatedFile = Files.createTempFile(CONSUMER_POM_CLASSIFIER,
"pom");
+ } else {
+ Path buildDir = Paths.get(buildDirectory);
+ Files.createDirectories(buildDir);
+ generatedFile = Files.createTempFile(buildDir,
CONSUMER_POM_CLASSIFIER, "pom");
+ }
+ project.addAttachedArtifact(new ConsumerPomArtifact(project,
generatedFile, session));
Review Comment:
@michael-o fixed in resolver 1.9.4, that's not the case anymore.
@rfscholte yes, as intention here is to make pgp plugin (and any other, like
checksum) in unchanged way
> Reimplement Consumer POM feature
> --------------------------------
>
> Key: MNG-7622
> URL: https://issues.apache.org/jira/browse/MNG-7622
> Project: Maven
> Issue Type: Task
> Components: build/consumer
> Reporter: Tamas Cservenak
> Priority: Major
> Fix For: 4.0.x-candidate
>
>
> Current implementation relies on deprecated resolver API (is deprecated as it
> is OOM prone), and also renders use cases like m-gpg-p but also checksum-m-p
> broken.
> Reimplement consumer POM feature that:
> * does not use FileTransformer API
> * allows use cases like m-gpg-p
--
This message was sent by Atlassian Jira
(v8.20.10#820010)