Hi.

This looks like an issue for me, I didn’t manage to find it in GitHub.

1. Consider next project structure: parent and child

pom.xml:
```
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0";
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.example</groupId>
    <artifactId>maven4-test-with-profiles</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>pom</packaging>
    <profiles>
        <profile>
            <id>one</id>
            <modules>
                <module>m1</module>
            </modules>
        </profile>
    </profiles>

</project>
```

2. Subproject is also pretty simple
m1/pom.xml:
```
<parent>
        <groupId>org.example</groupId>
        <artifactId>maven4-test-with-profiles</artifactId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <artifactId>m1</artifactId>
```

3. I use maven4-rc4

5. When I compile the project using ‘mvn compile` I got only 
maven4-test-with-profiles in reactor. When I run 'mvn -P one compile’ I got two 
modules in reactor -  maven4-test-with-profiles and m1. Everything is ok.

6. Now, lets change model (with schemas) to 4.1.0

7. Regardless of profile flags, m1 is always included into reactor.  Even if 
you run 'mvn -P!one compile’ reactor will contain m1. That means, that you 
cannot build the project, if m1 contains code/tests which by some reasons are 
not valid without the profile.

Is it expected behaviour? Documentation says 
https://maven.apache.org/whatsnewinmaven4.html - However, Maven does not build 
subprojects unless they are linked from the root POM file.
So, there’s nothing changed in maven4. 

We can change modules tag to subprojects, it does not affect the behaviour.


Is it an expected behaviour (it worth documenting), known issue, or I should 
fire a ticket in GitHub?

Thanks, Alex

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org

Reply via email to