Skip to content

Commit

Permalink
merge and resolve conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
bsorrentino committed Mar 5, 2020
2 parents d7a5461 + 128a2be commit ef78c75
Showing 1 changed file with 10 additions and 43 deletions.
53 changes: 10 additions & 43 deletions src/main/java/org/bsc/maven/plugin/libutils/DeployFolderMojo.java
Original file line number Diff line number Diff line change
@@ -1,20 +1,5 @@
package org.bsc.maven.plugin.libutils;

import static java.lang.String.format;
import static org.apache.commons.lang3.StringUtils.defaultIfBlank;
import static org.apache.commons.lang3.StringUtils.isBlank;
import static org.bsc.maven.plugin.libutils.MojoUtils.getArtifactCoordinateFromPropsInJar;
import static org.codehaus.plexus.util.FileUtils.copyFile;
import static org.codehaus.plexus.util.FileUtils.getFiles;

import java.io.File;
import java.io.IOException;
import java.io.Writer;
import java.util.Map;
import java.util.Optional;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.DefaultArtifact;
import org.apache.maven.artifact.handler.ArtifactHandler;
Expand All @@ -26,10 +11,9 @@
import org.apache.maven.model.Model;
import org.apache.maven.model.io.DefaultModelWriter;
import org.apache.maven.model.io.ModelWriter;
import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.Component;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
Expand Down Expand Up @@ -507,33 +491,17 @@ private Artifact execute(File file, Optional<ArtifactRepository> deploymentRepos

Artifact result = null;

final Optional<Artifact> artifact =
getArtifactCoordinateFromPropsInJar(jarFile, this::createBuildArtifact );

if( artifact.isPresent() ) {
result = artifact.get();
getLog().info( format("artifact [%s] is already a maven artifact!", result));
isMavenArtifact = true;
}

}

if( !isMavenArtifact ) {
result = createNotStandardArtifact(candidateArtifactId, packaging);
}

if (isPreviewMode() || !deploymentRepository.isPresent()) {
return result;
}
// // PROCESSING POM
if( "pom".compareToIgnoreCase(packaging)==0 ) {
final MavenXpp3Reader reader = new MavenXpp3Reader();

final Model model = reader.read(new java.io.FileReader(file));

// Upload the POM if requested, generating one if need be
if (!isMavenArtifact && generatePom) {
ProjectArtifactMetadata metadata =
new ProjectArtifactMetadata(result,
generatePomFile(result.getArtifactId(), packaging, result.getVersion()));
result.addMetadata(metadata);
result = createBuildArtifact(
model.getGroupId(),
model.getArtifactId(),
model.getVersion(),
model.getPackaging() );
}
else { // PROCESSING JAR

Expand All @@ -558,11 +526,10 @@ private Artifact execute(File file, Optional<ArtifactRepository> deploymentRepos
result = createNotStandardArtifact(candidateArtifactId, packaging);
}

if (preview || !deploymentRepository.isPresent()) {
if (isPreviewMode() || !deploymentRepository.isPresent()) {
return result;
}


// Upload the POM if requested, generating one if need be
if (!isMavenArtifact && generatePom) {
ProjectArtifactMetadata metadata =
Expand Down

0 comments on commit ef78c75

Please sign in to comment.