2

I have a Java file which is executed during maven:compile phase to perform some file adjustments on each compilation.

<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>exec-maven-plugin</artifactId>
  <version>1.4.0</version>
  <executions>
      <execution>
          <id>build-dump</id>
          <phase>compile</phase>
          <goals>
              <goal>java</goal>
          </goals>
      </execution>
  </executions>
  <configuration>
      <mainClass>com.domain.internal.UpdateFile</mainClass>
  </configuration>
</plugin>

The thing is that this file is only for code maintenance and it is not needed in the final Jar package, so how can I exclude this file from being packaged into the final Jar while I keep it executing the maintenance code?

Thank you in advance.

Joe Almore
  • 4,036
  • 9
  • 52
  • 77
  • 2
    One option is to have this file in another jar file(maven artifact) and use it as maven dependency, then you can specify scope compile for this dependency and it will not be included in the build. – Sergei Sirik Jan 18 '19 at 23:55
  • Also, take a look at this: https://stackoverflow.com/questions/30023509/i-wish-to-exclude-some-class-files-from-my-jar-i-am-using-maven-assembly-plugin/30051240 – Sergei Sirik Jan 18 '19 at 23:57
  • First is this modifying the source code or the class files? – khmarbaise Jan 19 '19 at 08:13

0 Answers0