views:

1604

answers:

2

I am working on a collection MATLAB, Java, and C/C++ components that all inter-operate, but have distinctly different compilation/installation steps. We currently don't compile anything for MATLAB, use maven2 for our Java build and unit tests, and use autotools for our C/C++ build and unit tests.

I would like to move everything to a single build and unit test system, using maven2, but have not been able to find a plugin that will allow the C/C++ codestream to remain autotools-based and simply wrap it in a maven build. Having to rip out autotools support and recreate all the dependencies in maven is most likely a deal-breaker, so I'm looking for a way for maven and autotools to play nicely together, rather than having to choose between the two.

Is this possible or even desirable? Are there resources out there that I have overlooked?

+1  A: 

I don't really know autotools, but can't you use the maven exec plugin, that lets you execute system commands (or Java programs)? For example:

<build>
  <plugins>
    <plugin>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>exec-maven-plugin</artifactId>
      <executions>
        <execution>
          <id>exec-one</id>
          <phase>compile</phase>
          <configuration>
            <executable>autogen</executable>
            <arguments>
              <argument>-v</argument>
            </arguments>
          </configuration>
          <goals>
            <goal>exec</goal>
          </goals>
        </execution>

        <execution>
          <id>exec-two</id>
          <phase>compile</phase>
          <configuration>
            <executable>automake</executable>
            <arguments>
              <argument>-v</argument>
              <argument>[other arguments]</argument>
            </arguments>
          </configuration>
          <goals>
            <goal>exec</goal>
          </goals>
        </execution>
      </executions>
    </plugin>
  </plugins>
</build>

I didn't test the pom fragment above, but it gives you some hints about how to proceed.

Luc Touraille
I was looking for some way that I don't have to translate every maven command to a system command. It complicates maintenance and is not nearly as clean as a Java build. If I end up having to script everything, I'll probably end up working outside of maven for the C/C++ tools.
jvasak
+1  A: 

You did overlook the maven cbuild parent suite. take a look at the "make-maven-plugin" section for more details.

Badri
This looks promising, but they are still only claiming alpha status. Definitely something to track and right along the lines of what I was looking for. I'll update more after I test out the available functionality.
jvasak