Using maven2 to create a C / C ++ package based on autotools

I am working on MATLAB, Java and C / C ++ components that all interact but have completely different compilation / installation steps. We are not currently collecting anything for MATLAB, we are using maven2 for our Java build and modulation tests, and we are using autotools for our C / C ++ build and modulation tests.

I would like to move everything to the same build system and unit test using maven2, but could not find a plugin that would allow the C / C ++ codestream to remain autotools based and just wrap it in maven build. To get rid of autotools support and recreate all the dependencies in maven, it's most likely a transaction breaker, so I'm looking for a way for maven and autotools to play well together, instead of choosing between them.

Is this possible or even desirable? Are there any resources that I forgot?

+3
source share
2 answers

I do not know autotools, but you can not use the maven exec plugin , which allows you to execute system commands (or Java programs)? For instance:

<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 have not tested the pom snippet above, but it gives you some tips on how to proceed.

+1
source

You looked at the maven cbuild parent package . see the make-maven-plugin section for more details.

+1
source

Source: https://habr.com/ru/post/1698142/


All Articles