Class AbstractCassandraMojo

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected boolean addMainClasspath
      Adds the main classpath to cassandra (for example you could use this when you have a custom comparator on your main classpath.
      protected boolean addTestClasspath
      Adds the test classpath to cassandra (for example you could use this when you have a custom comparator on your test classpath.
      protected File cassandraDir
      The directory to hold cassandra's database.
      protected int jmxPort
      Port to listen to for the JMX interface.
      protected String keyspace
      The keyspace against which individual operations will be executed
      protected String listenAddress
      Address to bind to and tell other Cassandra nodes to connect to.
      protected String logLevel
      Log level of cassandra process.
      protected int maxMemory
      Number of megabytes to limit the cassandra JVM to.
      protected int nativeTransportPort
      Port on which the CQL native transport listens for clients.
      protected org.apache.maven.project.MavenProject project
      The enclosing project.
      protected String rpcAddress
      Address to use for the RPC interface.
      protected org.apache.maven.execution.MavenSession session
      The current build session instance.
      protected boolean skip
      Skip the execution.
      protected boolean startNativeTransport
      Enable or disable the native transport server.
      protected String stopKey
      Key to be provided when stopping cassandra
      protected int stopPort
      Port to listen to for receiving the stop command over
      protected int storagePort
      Port to listen to for the Storage interface.
      protected Map<String,​String> systemPropertyVariables
      List of System properties to pass to the JUnit tests.
      • Fields inherited from interface org.apache.maven.plugin.Mojo

        ROLE
    • Field Detail

      • cassandraDir

        @Parameter(defaultValue="${project.build.directory}/cassandra")
        protected File cassandraDir
        The directory to hold cassandra's database.
      • project

        @Parameter(readonly=true)
        protected org.apache.maven.project.MavenProject project
        The enclosing project.
      • addTestClasspath

        @Parameter(defaultValue="false")
        protected boolean addTestClasspath
        Adds 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 addMainClasspath
        Adds 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 skip
        Skip the execution.
      • session

        @Parameter(defaultValue="${session}",
                   required=true,
                   readonly=true)
        protected org.apache.maven.execution.MavenSession session
        The current build session instance. This is used for toolchain manager API calls.
      • rpcAddress

        @Parameter(defaultValue="127.0.0.1",
                   required=true)
        protected String rpcAddress
        Address to use for the RPC interface. Do not change this unless you really know what you are doing.
      • jmxPort

        @Parameter(property="cassandra.jmxPort",
                   defaultValue="7199")
        protected int jmxPort
        Port to listen to for the JMX interface.
      • nativeTransportPort

        @Parameter(property="cassandra.nativeTransportPort",
                   defaultValue="9042")
        protected int nativeTransportPort
        Port on which the CQL native transport listens for clients.
        Since:
        2.0.0-1
      • startNativeTransport

        @Parameter(property="cassandra.startNativeTransport",
                   defaultValue="true")
        protected boolean startNativeTransport
        Enable 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

        @Parameter(defaultValue="127.0.0.1")
        protected String 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 storagePort
        Port to listen to for the Storage interface.
      • stopPort

        @Parameter(property="cassandra.stopPort",
                   defaultValue="8081")
        protected int stopPort
        Port to listen to for receiving the stop command over
      • stopKey

        @Parameter(property="cassandra.stopKey",
                   defaultValue="cassandra-maven-plugin")
        protected String stopKey
        Key to be provided when stopping cassandra
      • maxMemory

        @Parameter(property="cassandra.maxMemory",
                   defaultValue="512")
        protected int maxMemory
        Number of megabytes to limit the cassandra JVM to.
      • keyspace

        @Parameter(property="cassandra.keyspace")
        protected String keyspace
        The keyspace against which individual operations will be executed
      • systemPropertyVariables

        @Parameter
        protected Map<String,​String> systemPropertyVariables
        List of System properties to pass to the JUnit tests.
        Since:
        1.2.1-2
      • logLevel

        @Parameter(defaultValue="ERROR")
        protected String logLevel
        Log level of cassandra process. Logging is performed via log4j2.
        Since:
        3.5
    • Constructor Detail

      • AbstractCassandraMojo

        public AbstractCassandraMojo()
    • Method Detail

      • createCassandraJar

        protected void createCassandraJar​(File jarFile,
                                          String mainClass)
                                   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/update
        mainClass - 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/update
        mainClass - The main class to run.
        Throws:
        IOException - if something went wrong.
      • createCassandraHome

        protected void createCassandraHome()
                                    throws IOException
        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 a CommandLine to launch Java.
        Returns:
        a CommandLine to launch Java.
      • createEnvironmentVars

        protected Map<String,​String> createEnvironmentVars()
        Creates the environment required when launching Cassandra or the CLI tools.
        Returns:
        the environment required when launching Cassandra or the CLI tools.
      • newServiceCommandLine

        protected org.apache.commons.exec.CommandLine newServiceCommandLine()
                                                                     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.
      • 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 the nodetool utility.
        Parameters:
        args - the command line arguments to pass to the nodetool utility.
        Returns:
        the CommandLine to launch nodetool with the supplied arguments.
        Throws:
        IOException - if there are issues creating the cassandra home directory.