Dendromus Denary
Dendromus Denary

Reputation: 61

How to create a new classes for each compilation using maven plugin

In case of my project I need to create new classes after each compilation. For compilation I'm using maven compiler plugin 3.1. I tried to use compilerReuseStrategy = alwaysNew option but it didn't make any affect, it always compile only changed classes. Here is plugin declaration in pom.xml:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.1</version>
    <configuration>
        <source>1.8</source>
        <target>1.8</target>
            <compilerReuseStrategy>alwaysNew</compilerReuseStrategy>
    </configuration>
</plugin>

An I doing something wrong or that's a bug and this option really doesn't work?

Upvotes: 0

Views: 489

Answers (2)

khmarbaise
khmarbaise

Reputation: 97547

If you are talking about the incremental feature fo the maven-compiler-plugin you can change this behaviour by the following configuration:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.1</version>
    <configuration>
        <source>1.8</source>
        <target>1.8</target>
        <useIncrementalCompilation>false</useIncrementalCompilation>
    </configuration>
</plugin>

The compileReuseStrategy in contradiction is intended to define the behaviour in relationship with multi-threaded running of the compiler.

Upvotes: 1

thomas.scheuchzer
thomas.scheuchzer

Reputation: 399

What about using mvn clean install?

Upvotes: 0

Related Questions