[ 
https://issues.apache.org/jira/browse/MDEPLOY-118?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17725408#comment-17725408
 ] 

ASF GitHub Bot commented on MDEPLOY-118:
----------------------------------------

elharo commented on code in PR #28:
URL: 
https://github.com/apache/maven-deploy-plugin/pull/28#discussion_r1202292334


##########
src/it/compare-pom/setup.bsh:
##########
@@ -0,0 +1,33 @@
+/*
+ * 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.
+ */
+
+import java.io.*;
+import java.util.*;
+
+import org.codehaus.plexus.util.*;
+
+File file = new File( localRepositoryPath, 
"org/apache/maven/its/deploy/comparepom" );
+System.out.println( "Deleting " + file );

Review Comment:
   You shouldn't need to print debug messages in tests.



##########
src/it/compare-pom/setup.bsh:
##########
@@ -0,0 +1,33 @@
+/*
+ * 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.
+ */
+
+import java.io.*;
+import java.util.*;
+
+import org.codehaus.plexus.util.*;
+
+File file = new File( localRepositoryPath, 
"org/apache/maven/its/deploy/comparepom" );
+System.out.println( "Deleting " + file );
+FileUtils.deleteDirectory( file );
+
+file = new File( basedir, "repo" );
+System.out.println( "Deleting " + file );

Review Comment:
   delete



##########
src/main/java/org/apache/maven/plugins/deploy/TempLocalRepoSession.java:
##########
@@ -0,0 +1,104 @@
+package org.apache.maven.plugins.deploy;
+
+/*
+ * 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.
+ */
+
+import java.io.Closeable;
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import org.codehaus.plexus.util.FileUtils;
+import org.eclipse.aether.AbstractForwardingRepositorySystemSession;
+import org.eclipse.aether.DefaultRepositoryCache;
+import org.eclipse.aether.RepositoryCache;
+import org.eclipse.aether.RepositorySystem;
+import org.eclipse.aether.RepositorySystemSession;
+import org.eclipse.aether.repository.LocalRepository;
+import org.eclipse.aether.repository.LocalRepositoryManager;
+import org.eclipse.aether.repository.WorkspaceReader;
+
+/**
+ *
+ */
+class TempLocalRepoSession extends AbstractForwardingRepositorySystemSession 
implements Closeable
+{
+    private final RepositorySystemSession origSession;
+    private final RepositoryCache cache;
+    private final File tempBasedir;
+    private LocalRepositoryManager lrm;

Review Comment:
   avoid abbreviation



##########
src/main/java/org/apache/maven/plugins/deploy/TempLocalRepoSession.java:
##########
@@ -0,0 +1,104 @@
+package org.apache.maven.plugins.deploy;
+
+/*
+ * 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.
+ */
+
+import java.io.Closeable;
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import org.codehaus.plexus.util.FileUtils;

Review Comment:
   prefer Apache commons-io for this functionality



##########
src/main/java/org/apache/maven/plugins/deploy/TempLocalRepoSession.java:
##########
@@ -0,0 +1,104 @@
+package org.apache.maven.plugins.deploy;
+
+/*
+ * 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.
+ */
+
+import java.io.Closeable;
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import org.codehaus.plexus.util.FileUtils;
+import org.eclipse.aether.AbstractForwardingRepositorySystemSession;
+import org.eclipse.aether.DefaultRepositoryCache;
+import org.eclipse.aether.RepositoryCache;
+import org.eclipse.aether.RepositorySystem;
+import org.eclipse.aether.RepositorySystemSession;
+import org.eclipse.aether.repository.LocalRepository;
+import org.eclipse.aether.repository.LocalRepositoryManager;
+import org.eclipse.aether.repository.WorkspaceReader;
+
+/**
+ *
+ */
+class TempLocalRepoSession extends AbstractForwardingRepositorySystemSession 
implements Closeable
+{
+    private final RepositorySystemSession origSession;

Review Comment:
   orig --> original



##########
src/it/compare-pom/verify.groovy:
##########
@@ -0,0 +1,89 @@
+/*
+ * 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.
+ */
+
+class LogInspector
+{
+    File log;
+    int index;
+    LogInspector( File log )
+    {
+        this.log = log;
+        this.index = 0;
+    }
+    boolean containsAfter( CharSequence text )
+    {
+        int newIdx = log.text.indexOf( text, index + 1 )
+        if ( newIdx > index)
+        {
+            index = newIdx
+            return true
+        }
+        return false
+    }
+    String toString ()
+    {
+        return "Log file ${log} after index ${index}."
+    }
+}
+
+
+assert new File( basedir, 
"repo/org/apache/maven/its/deploy/comparepom/test/maven-metadata.xml" ).exists()
+
+File snDir = new File( basedir, 
"repo/org/apache/maven/its/deploy/comparepom/test/1.0-SNAPSHOT/" )
+assert snDir.list( {d, f -> f ==~ /test-1.0-.*-first.jar/} as FilenameFilter 
).size() == 1
+assert snDir.list( {d, f -> f ==~ /test-1.0-.*-second.jar/} as FilenameFilter 
).size() == 1
+assert snDir.list( {d, f -> f ==~ /test-1.0-.*.pom/} as FilenameFilter 
).size() == 2
+
+assert new File( basedir, 
"repo/org/apache/maven/its/deploy/comparepom/test/1.0/test-1.0-first.jar" 
).exists()
+assert new File( basedir, 
"repo/org/apache/maven/its/deploy/comparepom/test/1.0/test-1.0-second.jar").exists()
+
+File deployedPom = new File( basedir, 
"repo/org/apache/maven/its/deploy/comparepom/test/1.0/test-1.0.pom" )
+assert deployedPom.exists()
+assert ! deployedPom.text.contains("Modified POM!")
+
+File installedPom = new File( localRepositoryPath, 
"org/apache/maven/its/deploy/comparepom/test/1.0/test-1.0.pom" )
+assert installedPom.exists()
+assert installedPom.text.contains("Modified POM!")
+
+File buildLog = new File( basedir, 'build.log' )
+assert buildLog.exists()
+
+// Inspect log
+LogInspector li = new LogInspector( buildLog )
+String groupUrl = 
"file:///${basedir}/repo/org/apache/maven/its/deploy/comparepom"
+
+// 1st and 2nd run: The POM tried to be downloaded and uploaded:

Review Comment:
   Log messages are not reliable over time. Tests should not use them to 
inspect behavior.





> Enable deployment of attached release artifacts if POM is identical
> -------------------------------------------------------------------
>
>                 Key: MDEPLOY-118
>                 URL: https://issues.apache.org/jira/browse/MDEPLOY-118
>             Project: Maven Deploy Plugin
>          Issue Type: Improvement
>    Affects Versions: 2.4
>         Environment: Windows XP SP3
>            Reporter: Bruno Freudensprung
>            Priority: Major
>              Labels: contributers-welcome
>
> In the context of the build of a native application, one might have 
> zip-artifacts containing several DLL or so files like:
> boost:boost_regex:1.34.1:zip
> In order to distinguish between platforms, it seems to be recommended to use 
> the classifier:
> boost:boost_regex:1.34.1:zip:bin-x86-windows-vc8
> or:
> boost:boost_regex:1.34.1:zip:bin-x86-linux2.6-gcc3.3
> If a Maven repository manager is configured to prevent from re-deploying 
> release artifacts (and I believe it should be), it is not possible to deploy 
> attached artifacts when the POM is the same because the POM is deployed 
> twice. The deploy plugin could check that the POM is already deployed and is 
> the same than the local one (modulo platform-dependent line-break concerns, 
> and that's important!), then choose not to deploy it but only the attached 
> artifact.
> In the example above, it could enable to deploy the 
> boost:boost_regex:1.34.1:zip:bin-x86-windows-vc8 artifact from a Windows 
> machine(coming along with a boost:boost_regex:1.34.1:pom artifact), then to 
> deploy the boost:boost_regex:1.34.1:zip:bin-x86-linux2.6-gcc3.3 artifact from 
> a Linux machine (coming along with the same boost:boost_regex:1.34.1:pom 
> artifact, that will not be deployed since it is identical to the first one 
> deployed).
> Maybe this could be generalized to any kind of artifact? If the artifact to 
> deploy is the same, the plugin should not fail and simply skip the deployment 
> of that artifact?
> I post that bug here on a suggestion of Brett Porter (see the MRM-1357 bug) 
> since it is quite unclear to me whether it is a MRM or deploy plugin concern.
> That bug might also be related to:
> - MDEPLOY-117
> - MDEPLOY-114



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to