Why are classes from generated sources gone when running mvn install twice?

Viewed 190

I have a project which generates java classes with jaxb from xsd schema.

the pom contains

        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>jaxb2-maven-plugin</artifactId>
            <version>2.2</version>
            <executions>
                <execution>
                    <id>xjc</id>
                    <goals>
                        <goal>xjc</goal>
                    </goals>
                    <phase>generate-sources</phase>
                </execution>
            </executions>
            <configuration>
                <!-- The package of your generated sources -->
                <packageName>com.melexis.mfgdil.b2mml</packageName>
                <sources>
                    <source>src/main/schema/AllSchemas.xsd</source>
                </sources>
            </configuration>
        </plugin>

When I type mvn clean install the java sources are generated from the xsd files into target/generated-sources/jaxb, compiled and end up in target/classes, great!

When I dare to immediately run mvn install again, without changing anything, I see :

[INFO] --- jaxb2-maven-plugin:2.2:xjc (xjc) @ b2mml ---
[INFO] Ignored given or default xjbSources 
[/home/pti/Projects/b2mml/src/main/xjb], since it is not an existent file or directory.
[INFO] No changes detected in schema or binding files - skipping JAXB 
generation.  
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ b2mml ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ b2mml ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /home/pti/Projects/b2mml/target/classes
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ b2mml ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/pti/Projects/b2mml/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ 

b2mml --- [INFO] Nothing to compile - all classes are up to date [INFO]

the target/classes folder is wiped and all classes from the target/generated-sources are gone and only the single class from the single java source file in my src/main/java tree is left.

I do not get why maven detects changes, and I get even less that it then recompiles the module, but forgets the generated-sources. What am I forgetting?

0 Answers
Related