Hi Francois, Someone on SO has explained that this is related to bug https://issues.apache.org/jira/browse/MNG-3283
The maven-exec-plugin has "requiresDependencyResolution = ResolutionScope.TEST" You can see that annotation here: https://github.com/mojohaus/exec-maven-plugin/blob/master/src/main/java/org/codehaus/mojo/exec/ExecJavaMojo.java So basically, even though it runs early in the lifecycle phase, it dies because it expects output to be ready for all dependencies. The "includeProjectDependencies" setting (which I assumed would change this behaviour) thus becomes irrelevant: it simply means that the resolved dependencies will not be in the execution classpath, but Maven still expects them to be available. The output is simple: "mvn compile" output: ---------------------------- [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] Reactor Build Order: [INFO] [INFO] parent-prj [pom] [INFO] sub-prj [jar] [INFO] gen-src-prj [jar] [INFO] [INFO] --------------------------< mygrp:parent-prj >-------------------------- [INFO] Building parent-prj 1.0.0-SNAPSHOT [1/3] [INFO] --------------------------------[ pom ]--------------------------------- [INFO] [INFO] ---------------------------< mygrp:sub-prj >---------------------------- [INFO] Building sub-prj 1.0.0-SNAPSHOT [2/3] [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ sub-prj --- [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! [INFO] skip non existing resourceDirectory /Users/karypid/d/wc/parent-prj/sub-prj/src/main/resources [INFO] [INFO] --- maven-compiler-plugin:3.3:compile (default-compile) @ sub-prj --- [INFO] No sources to compile [INFO] [INFO] -------------------------< mygrp:gen-src-prj >-------------------------- [INFO] Building gen-src-prj 1.0.0-SNAPSHOT [3/3] [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- exec-maven-plugin:1.6.0:java (default) @ gen-src-prj --- [Fatal Error] :1:1: Premature end of file. [WARNING] org.xml.sax.SAXParseException: Premature end of file. at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse (DOMParser.java:257) at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse (DocumentBuilderImpl.java:339) at javax.xml.parsers.DocumentBuilder.parse (DocumentBuilder.java:121) ABOVE IS CORRECT BEHAVIOUR: the plugin is executed but fails because it is missing the "Examples.xml" file which I do not have in this example. Now contrast this to the output below which exhibits the incorrect/unexpected behaviour: "mvn generate-sources" output: ---------------------------- [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] Reactor Build Order: [INFO] [INFO] parent-prj [pom] [INFO] sub-prj [jar] [INFO] gen-src-prj [jar] [INFO] [INFO] --------------------------< mygrp:parent-prj >-------------------------- [INFO] Building parent-prj 1.0.0-SNAPSHOT [1/3] [INFO] --------------------------------[ pom ]--------------------------------- [INFO] [INFO] ---------------------------< mygrp:sub-prj >---------------------------- [INFO] Building sub-prj 1.0.0-SNAPSHOT [2/3] [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] -------------------------< mygrp:gen-src-prj >-------------------------- [INFO] Building gen-src-prj 1.0.0-SNAPSHOT [3/3] [INFO] --------------------------------[ jar ]--------------------------------- [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary: [INFO] [INFO] parent-prj 1.0.0-SNAPSHOT .......................... SUCCESS [ 0.004 s] [INFO] sub-prj ............................................ SUCCESS [ 0.002 s] [INFO] gen-src-prj 1.0.0-SNAPSHOT ......................... FAILURE [ 0.090 s] [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 0.203 s [INFO] Finished at: 2018-05-20T09:02:29+01:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal on project gen-src-prj: Could not resolve dependencies for project mygrp:gen-src-prj:jar:1.0.0-SNAPSHOT: Could not find artifact mygrp:sub-prj:jar:1.0.0-SNAPSHOT -> [Help 1] As you can see Maven refuses to even attempt to invoke exec-maven-plugin. It was instructed by "requiresDependencyResolution = ResolutionScope.TEST" to resolve dependencies for TEST scope and since that cannot be done (I have nothing in my local repository, nor was any output created as we were not running the compile goal) it has no way of doing that. Basically I think it is more a problem of exec-maven-plugin code: it clearly asks Maven to behave like this. It should remove the annotation for requiresDependencyResolution and programmatically check for the presence of output in its code when "includeProjectDependencies" is set to true in its configuration. I was going to create an account to watch this bug, but then I noticed that it's been around 10 (!) years and has 26 votes and 37 watchers, so I doubt it will ever be fixed. It's a pity because I fully subscribe to the philosophy mentioned in this bug: https://issues.apache.org/jira/browse/MNG-3283?focusedCommentId=14415669&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-14415669 A lot of people I've worked with that have not contact with maven other than working on a project that uses it, complain about weird classpath issues. When I look into them, it always ends up being a user of IntelliJ that has not run "mvn install" for project A and cannot see his change in project B. I encourage people to NEVER run "mvn install" to avoid such issues, but this bug makes it impossible... (usually the problem happens in IntelliJ because m2eclipse prioritises workspace project by default; if you import A and B into your workspace Eclipse links against each other). -- Sent from: http://maven.40175.n5.nabble.com/Maven-Users-f40176.html --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org