Search code examples
mavenintellij-ideabuild

Maven: properties-maven-plugin not generating properties files in IntelliJ builds


How do you get IntelliJ maven projects to build in intelliJ and produce the xxx.properties file configured in the pom.xml?


I have to run a command-line mvn package for the properties file to get produced, and only then executions run inside IntellIJ run configurations are able to observe the file.

If i simply compile, the properties file is not produced, and IntelliJ run configurations are not able to observe the file (properties file not found).

It seems that IntelliJ is only running compile during builds...


I have a multi-module scala project being built with Maven. In the base pom in the I have added:

<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>properties-maven-plugin</artifactId>
  <version>1.0.0</version>
  <executions>
    <execution>
      <phase>generate-resources</phase>
      <goals>
        <goal>write-project-properties</goal>
      </goals>
      <configuration>
        <outputFile>${project.build.outputDirectory}/xxx.properties</outputFile>
      </configuration>
    </execution>
  </executions>
</plugin>

When i run mvn package, the target/classes/ folder of each module gets an xxx.properties file written into it. If I run an IntelliJ run configuration after this, all is well, the file is found.

If I mvn clean and only build the project using IntelliJ's build process, this file is NOT produced, and at execution time the file is not found. :(


Solution

  • This plug-in is not supported by IntelliJ IDEA build system yet.

    The workaround is to delegate the build to Maven.