Re: Problem with exec-maven-plugin

2018-05-19 Thread Francois MAROT
Hi Alex,

maybe you could paste here the output logs of the failing execution. I'd
like them to be sure I understand the problem.
Cheers

Francois



--
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



Re: Problem with exec-maven-plugin

2018-05-20 Thread Alex
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

Re: Problem with exec-maven-plugin

2018-05-24 Thread Alex
In the interest of providing full reference in the list, I have come up with
a workaround to achieve what I want: I list the dependencies in a profile
that is active by default, then use another profile to run generate-sources
with no dependencies active, like follows:

Added in parent-prj/gen-src-prj/pom.xml (and obviously remove existing
dependencies section)



default

true



mygrp
sub-prj
${project.version}





excludeDependency





To generate sources with above, use: mvn -PexcludeDependency
generate-sources

Also filed a bug against the plugin at:
https://github.com/mojohaus/exec-maven-plugin/issues/106




--
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