Skip to content

Maven Other FAQ

How to compile C++ code with Maven?

Alternative 1: Use exec-maven-plugin to call a make script.

Alternative 2: Use native-maven-plugin to call the compiler directly.

TODO Paste pom examples

How to package C++ code as rpm?

  1. Compile the code for the appropriate architecture(s). (See above)
  2. Deploy the artifact to a repository manager. (currently not working, todo add ref to jira)
  3. Use unix-maven-plugin to create the rpm. TODO: pom example

How to make the output of a shell command available to Maven?

If you cannot use any of the predefined properties mentioned in Java System Properties or Codehaus Maven Properties Guide, you might need to extract the information yourself. The following example shows how to fetch the version number of a linux distribution from /etc/issue:

TODO: This should probably be supported in a plugin. Which? Should update with reference to jira issue.

Running Jetty

Early versions of the Maven Jetty plugin was named maven-jetty-plugin, and would run as expected, e.g. >mvn jetty:run its pom.xml:

<plugin>
    <groupId>org.mortbay.jetty</groupId>
    <artifactId>maven-jetty-plugin</artifactId>
    <version>6.0.2</version>
</plugin>

Later versions (from 7) changed the plugin's name to conform to Maven convention, into jetty-maven-plugin, but now the expected 'mvn jetty:run' will not run! The documentation explains the use of , in effect similar to prefixing the run with the groupid and complete plugin name: >mvn org.mortbay.jetty:jetty-maven-plugin:run Its pom.xml

<plugin>
    <groupId>org.mortbay.jetty</groupId>
    <artifactId>jetty-maven-plugin</artifactId>
    <version>7.0.0.pre5</version>
</plugin>