groovy / gmaven

Groovy integration for Maven
http://groovy.github.io/gmaven/
Apache License 2.0
51 stars 21 forks source link

How can I change the version during deploy goal #13

Open betonetotbo opened 6 years ago

betonetotbo commented 6 years ago

I'm trying to create a dynamic version control using a groovy script like this:

<build> 
    <plugins>
            <plugin>
                <groupId>org.codehaus.gmaven</groupId>
                <artifactId>groovy-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>execute</goal>
                        </goals>
                        <configuration>
                            <source>
                                project.version = '1.0.0'
                                project.build.finalName = "${project.name}-1.0.0"
                            </source>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
</build>

In this example, I just trying to force the change of the version from 0.0.1-SNAPSHOT to 1.0.0.

The jar file name and it contents is created correct (ex. my-project-1.0.0.jar) but when the deploy goal starts, it deploy the JAR with the old name (my-proejct-0.0.1-SNAPSHOT.jar) on my maven distribution repository.

How can I solve this?

jdillon commented 6 years ago

I'm not sure there is a really good answer to this. Mutation of the project model like this is certainly not going to behave very well. Any reason why the maven-release-plugin doesn't work for you?