I don’t know the answer to your question, but maybe using a multi-release JAR 
(https://maven.apache.org/plugins/maven-compiler-plugin/multirelease.html) 
could also be an option for your use case?

Nils.

Niels Basjes <ni...@basjes.nl> wrote:

> I have in my project a maven module that is only activated if a specific
> profile is active (by default it is not active).
> Side note: It is an part that requires Java 22, optional during development
> and I do want to release it with the maven-release-plugin
> 
> I have put this profile into both the list of profiles that need to be
> active during preparation and release  (see sketch below).
> 
> When I do "mvn release:prepare" it does not update the module2/pom.xml with
> the new version.
> I found that I need to explicitly activate it on the commandline as well to
> activate it there too "mvn release:prepare -PActivateModule2"
> 
> I expected this profile to be active during the entire prepare phase (i.e.
> including the "update the version" part).
> 
> Is this an omission/bug or is this as intended?
> 
> Niels Basjes
> 
> <build>
>  <plugins>
>    <plugin>
>      <groupId>org.apache.maven.plugins</groupId>
>      <artifactId>maven-release-plugin</artifactId>
>      <version>3.1.1</version>
>      <configuration>
>        <preparationProfiles>ActivateModule2</preparationProfiles>
>        <releaseProfiles>ActivateModule2</releaseProfiles>
>      </configuration>
>    </plugin>
>  </plugins>
> </build>
> 
> <modules>
>  <module>module1</module>
> </modules>
> 
> <profiles>
>  <profile>
>    <id>ActivateModule2</id>
>    <modules>
>      <module>module2</module>
>    </modules>
>  </profile>
> </profiles>

Reply via email to