contraect-maven-plugin
  • Introduction
  • Use the plugin
    • Add dependencies
    • Plugin configuration
    • Plugin execution
      • Error Codes
  • Use the generated classes
    • Contraect interaction
    • Example applications
Powered by GitBook
On this page
  • Add generated classes to sources
  • Option 1
  • Option 2
  • Option 3

Was this helpful?

  1. Use the plugin

Plugin execution

The following mvn command can be used to explicitly generate the Java classes:

mvn contraect:generate-contraects

After the plugin execution you should find the generated Java classes in the folder you specified through the configuration property targetPath.

Alternatively the default maven lifecycle phase generate-sources can be called - therefore the plugin configuration has to be as follows

<plugin>
  <groupId>com.kryptokrauts</groupId>
  <artifactId>contraect-maven-plugin</artifactId>
  <version>2.0.0-RC1</version>
  ...
  <executions>
	  <execution>
		  <goals>
			  <goal>generate-contraects</goal>
			</goals>
		</execution>
	</executions>
</plugin>

Add generated classes to sources

Option 1

Add the folder manually as source-folder within your IDE.

Option 2

Generate classes directly into the regular source folder by defining src/main/java as targetPath.

Note: with this solution you will probably end up having the generated files committed to the repo

Option 3

Add the resources using the build-helper-maven-plugin:

<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>build-helper-maven-plugin</artifactId>
  <version>3.0.0</version>
  <executions>
    <execution>
      <phase>generate-sources</phase>
      <goals>
        <goal>add-source</goal>
      </goals>
      <configuration>
        <sources>
          <source>${project.build.directory}/generated-sources/contraect</source>
        </sources>
      </configuration>
    </execution>
  </executions>
</plugin>

PreviousPlugin configurationNextError Codes

Last updated 3 years ago

Was this helpful?