renaming/equalizing parameters on the maven plugins
This commit is contained in:
parent
e81f63f067
commit
c21bee63cb
|
@ -20,8 +20,10 @@ package org.apache.activemq.artemis.maven;
|
|||
import java.io.File;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import org.apache.activemq.artemis.cli.commands.Configurable;
|
||||
|
@ -145,4 +147,30 @@ public abstract class ArtemisAbstractPlugin extends AbstractMojo {
|
|||
return dependencies;
|
||||
}
|
||||
|
||||
protected Set<File> resolveDependencies(String[] dependencyListParameter, String[] individualListParameter) throws DependencyCollectionException, MojoFailureException, MojoExecutionException {
|
||||
Set<File> filesSet = new HashSet<>();
|
||||
if (dependencyListParameter != null) {
|
||||
for (String lib : dependencyListParameter) {
|
||||
getLog().debug("********************" + lib);
|
||||
|
||||
List<Artifact> artifactsList = explodeDependencies(newArtifact(lib));
|
||||
|
||||
for (Artifact artifact : artifactsList) {
|
||||
File artifactFile = resolveArtifact(artifact);
|
||||
filesSet.add(artifactFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (individualListParameter != null) {
|
||||
for (String lib : individualListParameter) {
|
||||
Artifact artifact = newArtifact(lib);
|
||||
getLog().debug("Single dpendency resolved::" + artifact);
|
||||
File artifactFile = resolveArtifact(artifact);
|
||||
filesSet.add(artifactFile);
|
||||
}
|
||||
}
|
||||
return filesSet;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -38,7 +38,6 @@ import org.apache.maven.plugins.annotations.LifecyclePhase;
|
|||
import org.apache.maven.plugins.annotations.Mojo;
|
||||
import org.apache.maven.plugins.annotations.Parameter;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
import org.eclipse.aether.artifact.Artifact;
|
||||
|
||||
@Mojo(name = "create", defaultPhase = LifecyclePhase.VERIFY)
|
||||
public class ArtemisCreatePlugin extends ArtemisAbstractPlugin {
|
||||
|
@ -120,14 +119,15 @@ public class ArtemisCreatePlugin extends ArtemisAbstractPlugin {
|
|||
@Parameter
|
||||
ArrayList<String> args = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Deprecated, use dependencyList and individualList
|
||||
*/
|
||||
@Parameter
|
||||
private String[] libList;
|
||||
|
||||
/**
|
||||
* copy dependencies listed on libList.
|
||||
*/
|
||||
@Parameter
|
||||
private boolean copyDependencies;
|
||||
private String[] libListWithDeps;
|
||||
|
||||
|
||||
@Parameter(defaultValue = "${localRepository}")
|
||||
private org.apache.maven.artifact.repository.ArtifactRepository localRepository;
|
||||
|
@ -290,30 +290,14 @@ public class ArtemisCreatePlugin extends ArtemisAbstractPlugin {
|
|||
}
|
||||
}
|
||||
|
||||
if (libList != null) {
|
||||
Set<File> files = resolveDependencies(libListWithDeps, libList);
|
||||
|
||||
if (!files.isEmpty() ) {
|
||||
commandLineStream.println();
|
||||
commandLineStream.println("# This is a list of files that need to be installed under ./lib.");
|
||||
commandLineStream.println("# We are copying them from your maven lib home");
|
||||
|
||||
for (int i = 0; i < libList.length; i++) {
|
||||
|
||||
Artifact artifact = newArtifact(libList[i]);
|
||||
getLog().debug("******************** Artifact::" + artifact);
|
||||
|
||||
|
||||
if (copyDependencies) {
|
||||
getLog().debug("******************** exploring dependencies::" + artifact);
|
||||
List<Artifact> dependencies = explodeDependencies(artifact);
|
||||
for (Artifact artifactItem : dependencies) {
|
||||
File artifactFile = resolveArtifact(artifactItem);
|
||||
copyToLib(artifactFile, commandLineStream);
|
||||
}
|
||||
}
|
||||
else {
|
||||
File artifactFile = resolveArtifact(artifact);
|
||||
getLog().debug("*********** coping Artifact:: " + artifact + " file = " + artifactFile);
|
||||
copyToLib(artifactFile, commandLineStream);
|
||||
}
|
||||
for (File file : files) {
|
||||
copyToLib(file, commandLineStream);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,8 @@
|
|||
package org.apache.activemq.artemis.maven;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
|
@ -28,7 +29,6 @@ import org.apache.maven.plugins.annotations.LifecyclePhase;
|
|||
import org.apache.maven.plugins.annotations.Mojo;
|
||||
import org.apache.maven.plugins.annotations.Parameter;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
import org.eclipse.aether.artifact.Artifact;
|
||||
|
||||
@Mojo(name = "dependency-scan", defaultPhase = LifecyclePhase.VERIFY)
|
||||
public class ArtemisDependencyScanPlugin extends ArtemisAbstractPlugin {
|
||||
|
@ -42,17 +42,21 @@ public class ArtemisDependencyScanPlugin extends ArtemisAbstractPlugin {
|
|||
private PluginDescriptor descriptor;
|
||||
|
||||
@Parameter
|
||||
private String[] dependencyList;
|
||||
private String[] libListWithDeps;
|
||||
|
||||
@Parameter
|
||||
private String[] individualList;
|
||||
private String[] libList;
|
||||
|
||||
@Parameter(required = true)
|
||||
@Parameter
|
||||
private String variableName;
|
||||
|
||||
@Parameter
|
||||
private String pathSeparator = File.pathSeparator;
|
||||
|
||||
/** Where to copy the exploded dependencies. */
|
||||
@Parameter
|
||||
private File targetFolder;
|
||||
|
||||
protected boolean isIgnore() {
|
||||
return false;
|
||||
}
|
||||
|
@ -71,38 +75,30 @@ public class ArtemisDependencyScanPlugin extends ArtemisAbstractPlugin {
|
|||
getLog().info("... key=" + entry.getKey() + " = " + entry.getValue());
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
String separatorUsed = "";
|
||||
if (dependencyList != null) {
|
||||
for (String lib : dependencyList) {
|
||||
getLog().debug("********************" + lib);
|
||||
Set<File> filesSet = resolveDependencies(libListWithDeps, libList);
|
||||
|
||||
List<Artifact> artifactsList = explodeDependencies(newArtifact(lib));
|
||||
|
||||
for (Artifact artifact : artifactsList) {
|
||||
File artifactFile = resolveArtifact(artifact);
|
||||
buffer.append(separatorUsed);
|
||||
buffer.append(artifactFile.getAbsolutePath());
|
||||
separatorUsed = pathSeparator;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (individualList != null) {
|
||||
for (String lib : individualList) {
|
||||
Artifact artifact = newArtifact(lib);
|
||||
getLog().info("Single dpendency resolved::" + artifact);
|
||||
File artifactFile = resolveArtifact(artifact);
|
||||
if (variableName != null) {
|
||||
String separatorUsed = "";
|
||||
for (File f : filesSet) {
|
||||
buffer.append(separatorUsed);
|
||||
buffer.append(artifactFile.getAbsolutePath());
|
||||
buffer.append(f.getAbsolutePath());
|
||||
separatorUsed = pathSeparator;
|
||||
}
|
||||
|
||||
String classPathGenerated = buffer.toString();
|
||||
project.getProperties().setProperty(variableName, classPathGenerated);
|
||||
getLog().info("dependency-scan setting: " + variableName + "=" + classPathGenerated);
|
||||
}
|
||||
|
||||
String classPathGenerated = buffer.toString();
|
||||
project.getProperties().setProperty(variableName, classPathGenerated);
|
||||
getLog().info("dependency-scan setting: " + variableName + "=" + classPathGenerated);
|
||||
if (targetFolder != null) {
|
||||
targetFolder.mkdirs();
|
||||
for (File file : filesSet) {
|
||||
Files.copy(file.toPath(), targetFolder.toPath(), StandardCopyOption.REPLACE_EXISTING);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Throwable e) {
|
||||
getLog().error(e);
|
||||
|
@ -110,5 +106,4 @@ public class ArtemisDependencyScanPlugin extends ArtemisAbstractPlugin {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -60,10 +60,9 @@ under the License.
|
|||
<configuration>
|
||||
<ignore>${noServer}</ignore>
|
||||
<!-- this list was extracted from mvn dependency:tree on integration/aerogear -->
|
||||
<libList>
|
||||
<libListWithDeps>
|
||||
<param>org.apache.activemq:artemis-aerogear-integration:${project.version}</param>
|
||||
</libList>
|
||||
<copyDependencies>true</copyDependencies>
|
||||
</libListWithDeps>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
|
|
|
@ -95,10 +95,9 @@ under the License.
|
|||
<goal>create</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<libList>
|
||||
<libListWithDeps>
|
||||
<arg>org.apache.activemq.examples.modules:artemis-vertx-example:${project.version}</arg>
|
||||
</libList>
|
||||
<copyDependencies>true</copyDependencies>
|
||||
</libListWithDeps>
|
||||
|
||||
<instance>${basedir}/target/server0</instance>
|
||||
<configuration>${basedir}/target/classes/activemq/server0</configuration>
|
||||
|
|
Loading…
Reference in New Issue