Package org.codehaus.mojo.cassandra
Class AbstractCassandraMojo
java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.codehaus.mojo.cassandra.AbstractCassandraMojo
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
- Direct Known Subclasses:
AbstractCqlExecMojo,AbstractSchemaCassandraMojo,CleanupCassandraMojo,CompactCassandraMojo,FlushCassandraMojo,LoadCassandraUnitDataSetMojo,RepairCassandraMojo,TruncateCassandraMojo
public abstract class AbstractCassandraMojo
extends org.apache.maven.plugin.AbstractMojo
Base class for all the Cassandra Maven Plugin goals.
- Author:
- stephenc
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanAdds the main classpath to cassandra (for example you could use this when you have a custom comparator on your main classpath.protected booleanAdds the test classpath to cassandra (for example you could use this when you have a custom comparator on your test classpath.protected FileThe directory to hold cassandra's database.protected intPort to listen to for the JMX interface.protected StringThe keyspace against which individual operations will be executedprotected StringAddress to bind to and tell other Cassandra nodes to connect to.protected StringLog level of cassandra process.protected intNumber of megabytes to limit the cassandra JVM to.protected intPort on which the CQL native transport listens for clients.protected org.apache.maven.project.MavenProjectThe enclosing project.protected StringAddress to use for the RPC interface.protected intPort to listen to for the RPC interface.protected org.apache.maven.execution.MavenSessionThe current build session instance.protected booleanSkip the execution.protected booleanEnable or disable the native transport server.protected StringKey to be provided when stopping cassandraprotected intPort to listen to for receiving the stop command overprotected intPort to listen to for the Storage interface.List of System properties to pass to the JUnit tests.Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidCreates the cassandra home directory.protected voidcreateCassandraHome(File cassandraDir, String listenAddress, String rpcAddress, BigInteger initialToken, String[] seeds) Creates the cassandra home directory.protected voidcreateCassandraJar(File jarFile, String mainClass) Create a jar with just a manifest containing a Main-Class entry for SurefireBooter and a Class-Path entry for all classpath elements.protected voidcreateCassandraJar(File jarFile, String mainClass, File cassandraDir) Create a jar with just a manifest containing a Main-Class entry for SurefireBooter and a Class-Path entry for all classpath elements.Creates the environment required when launching Cassandra or the CLI tools.protected org.apache.maven.toolchain.ToolchainGets the Java toolchain.protected org.apache.commons.exec.CommandLineCreate aCommandLineto launch Java.protected org.apache.commons.exec.CommandLinenewNodetoolCommandLine(String... args) Creates the command line to launch thenodetoolutility.protected org.apache.commons.exec.CommandLineCreates the command line to launch the cassandra server.protected org.apache.commons.exec.CommandLinenewServiceCommandLine(File cassandraDir, String listenAddress, String rpcAddress, BigInteger initialToken, String[] seeds, boolean jmxRemoteEnabled, int jmxPort) Creates the command line to launch the cassandra server.protected booleanMethods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContextMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.maven.plugin.Mojo
execute
-
Field Details
-
cassandraDir
The directory to hold cassandra's database. -
project
@Parameter(readonly=true) protected org.apache.maven.project.MavenProject projectThe enclosing project. -
addTestClasspath
@Parameter(defaultValue="false") protected boolean addTestClasspathAdds the test classpath to cassandra (for example you could use this when you have a custom comparator on your test classpath. -
addMainClasspath
@Parameter(defaultValue="false") protected boolean addMainClasspathAdds the main classpath to cassandra (for example you could use this when you have a custom comparator on your main classpath. -
skip
@Parameter(property="cassandra.skip", defaultValue="false") protected boolean skipSkip the execution. -
session
@Parameter(defaultValue="${session}", required=true, readonly=true) protected org.apache.maven.execution.MavenSession sessionThe current build session instance. This is used for toolchain manager API calls. -
rpcAddress
Address to use for the RPC interface. Do not change this unless you really know what you are doing. -
rpcPort
@Parameter(property="cassandra.rpcPort", defaultValue="9160") protected int rpcPortPort to listen to for the RPC interface. -
jmxPort
@Parameter(property="cassandra.jmxPort", defaultValue="7199") protected int jmxPortPort to listen to for the JMX interface. -
nativeTransportPort
@Parameter(property="cassandra.nativeTransportPort", defaultValue="9042") protected int nativeTransportPortPort on which the CQL native transport listens for clients.- Since:
- 2.0.0-1
-
startNativeTransport
@Parameter(property="cassandra.startNativeTransport", defaultValue="false") protected boolean startNativeTransportEnable or disable the native transport server. Currently, only the Thrift server is started by default because the native transport is considered beta.- Since:
- 2.0.0-1
-
listenAddress
Address to bind to and tell other Cassandra nodes to connect to. You must change this if you want multiple nodes to be able to communicate!
Leaving it blank leaves it up to InetAddress.getLocalHost(). This will always do the Right Thing if the node is properly configured (hostname, name resolution, etc), and the Right Thing is to use the address associated with the hostname (it might not be).
Setting this to 0.0.0.0 is always wrong. Do not change this unless you really know what you are doing. -
storagePort
@Parameter(property="cassandra.storagePort", defaultValue="7000") protected int storagePortPort to listen to for the Storage interface. -
stopPort
@Parameter(property="cassandra.stopPort", defaultValue="8081") protected int stopPortPort to listen to for receiving the stop command over -
stopKey
@Parameter(property="cassandra.stopKey", defaultValue="cassandra-maven-plugin") protected String stopKeyKey to be provided when stopping cassandra -
maxMemory
@Parameter(property="cassandra.maxMemory", defaultValue="512") protected int maxMemoryNumber of megabytes to limit the cassandra JVM to. -
keyspace
The keyspace against which individual operations will be executed -
systemPropertyVariables
List of System properties to pass to the JUnit tests.- Since:
- 1.2.1-2
-
logLevel
Log level of cassandra process. Logging is performed via log4j2.- Since:
- 3.5
-
-
Constructor Details
-
AbstractCassandraMojo
public AbstractCassandraMojo()
-
-
Method Details
-
createCassandraJar
Create a jar with just a manifest containing a Main-Class entry for SurefireBooter and a Class-Path entry for all classpath elements. Copied from surefire (ForkConfiguration#createJar())- Parameters:
jarFile- The jar file to create/updatemainClass- The main class to run.- Throws:
IOException- if something went wrong.
-
useJdk11Options
protected boolean useJdk11Options() -
createCassandraJar
protected void createCassandraJar(File jarFile, String mainClass, File cassandraDir) throws IOException Create a jar with just a manifest containing a Main-Class entry for SurefireBooter and a Class-Path entry for all classpath elements. Copied from surefire (ForkConfiguration#createJar())- Parameters:
jarFile- The jar file to create/updatemainClass- The main class to run.- Throws:
IOException- if something went wrong.
-
createCassandraHome
Creates the cassandra home directory.- Throws:
IOException- if something goes wrong.
-
createCassandraHome
protected void createCassandraHome(File cassandraDir, String listenAddress, String rpcAddress, BigInteger initialToken, String[] seeds) throws IOException Creates the cassandra home directory.- Parameters:
cassandraDir- the cassandra home directory.- Throws:
IOException- if something goes wrong.
-
getToolchain
protected org.apache.maven.toolchain.Toolchain getToolchain()Gets the Java toolchain.- Returns:
- the Java toolchain.
-
newJavaCommandLine
protected org.apache.commons.exec.CommandLine newJavaCommandLine()Create aCommandLineto launch Java.- Returns:
- a
CommandLineto launch Java.
-
createEnvironmentVars
Creates the environment required when launching Cassandra or the CLI tools.- Returns:
- the environment required when launching Cassandra or the CLI tools.
-
newServiceCommandLine
Creates the command line to launch the cassandra server.- Returns:
- the command line to launch the cassandra server.
- Throws:
IOException- if there are issues creating the cassandra home directory.
-
newServiceCommandLine
protected org.apache.commons.exec.CommandLine newServiceCommandLine(File cassandraDir, String listenAddress, String rpcAddress, BigInteger initialToken, String[] seeds, boolean jmxRemoteEnabled, int jmxPort) throws IOException Creates the command line to launch the cassandra server.- Returns:
- the command line to launch the cassandra server.
- Throws:
IOException- if there are issues creating the cassandra home directory.
-
newNodetoolCommandLine
protected org.apache.commons.exec.CommandLine newNodetoolCommandLine(String... args) throws IOException Creates the command line to launch thenodetoolutility.- Parameters:
args- the command line arguments to pass to thenodetoolutility.- Returns:
- the
CommandLineto launchnodetoolwith the supplied arguments. - Throws:
IOException- if there are issues creating the cassandra home directory.
-