However clean plugin at meantime removed some classes and generated sources because I run 'clean' phase (mvn clean install).
Is it possible to somehow enforce generation when 'clean' phase was run (without additional switches)?
Is it possible to somehow enforce generation when 'clean' phase was run (without additional switches)?
Nope, during 'clean' phase only the 'clean' goal of Sculptors Maven plugin is executed. The 'generate' goal of Sculptors Maven plugin is bound to the 'generate-sources' phase.
<plugin><groupId>org.sculptor</groupId><artifactId>sculptor-maven-plugin</artifactId><executions><execution><id>cleanup</id><goals><goal>clean</goal></goals></execution><execution><id>code-generation</id><phase>clean</phase><goals><goal>generate</goal></goals></execution></executions></plugin>
When you run 'clean install' or 'clean generate-sources', but you don't change any of (pom.xml, *.btdesign, ...) your build will 100% crash.
Or another question, what is purpose to skip generation when nothing changed? When I ask from Maven, please generate (install, generate-sources, ...) than generate, this should be default behavior. Why are we skipping generation, that's 99% of cases why we run maven.
Why to enforce with another switch? Maybe we can introduce switch 'please check changes' if somebody want but I don't know such case anyway.
When you run 'clean install' or 'clean generate-sources', but you don't change any of (pom.xml, *.btdesign, ...) your build will 100% crash.
What do you mean by "crash"?
Running "mvn clean install" in a project with unmodified Sculptor model will delete the previously generated stuff, then re-generate the Sculptor stuff and finally compile all the java classes (generated and manually created) in the project. Here I can't see a reason for crashing the build. At least not the builds I'm working with :-P
You can try this with the Sculptor Examples and Tutorials. I'd to do this plenty during migration of the examples and the documentation :-)
Or another question, what is purpose to skip generation when nothing changed? When I ask from Maven, please generate (install, generate-sources, ...) than generate, this should be default behavior. Why are we skipping generation, that's 99% of cases why we run maven.
That's for performance reasons. If running "mvn install" (e.g. during CI build) on a fairly complex Maven reactor (maybe with multiple module using Sculptor code generation) then you're not interested in getting re-generating unmodified stuff. Therefore "expensive" Maven plugins detect if anything changed and only run the "expensive" stuff if neccessary, e.g. compiler plugin uses timestamp approach, Castor plugin uses a copy-approach, dependency:unpack uses a marker directory approach, ...
Why to enforce with another switch? Maybe we can introduce switch 'please check changes' if somebody want but I don't know such case anyway.
From my experience using Scuptor in a fairly complex project manually "forcing" a Sculptor generation is rarely used. Basically I'm only aware of a single use case: Someone changes the Scuptor special-cases stuff.
Only a few devs are modifying the Sculptor model files. In this case the Sculptor Maven plugin kicks in and re-generates the code. The other devs are only using or modifying the generated stuff. These guys are not interested re-generating the whole universe e.g. while running the unit tests of a complex Maven reactor via "mvn test".