Karaf 4 distribution local build fails on Windows (missing "patch")

Description

Would be better to document that "patch" needs to be on execution path for building on windows

[INFO] ODL :: genius :: fcapsapplication .................. SUCCESS [ 0.863 s]
[INFO] ODL :: genius :: resourcemanager-aggregator ........ SUCCESS [ 0.839 s]
[INFO] ODL :: genius :: genius-karaf4 ..................... FAILURE [34:46 min]
[INFO] ODL :: genius :: genius-it ......................... SKIPPED
[INFO] genius ............................................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 45:54 min
[INFO] Finished at: 2017-06-13T05:42:08+05:30
[INFO] Final Memory: 362M/927M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.8:run (patch-karaf-scripts) on project genius-karaf4: An Ant BuildException has occured: java.io.IOException: Cannot run progra
m "patch" (in directory "C:\Users\efaseel\odl_boron\genius\karaf4"): CreateProcess error=2, The system cannot find the file specified
[ERROR] around Ant part ...<patch patchfile="C:\Users\efaseel\odl_boron\genius\karaf4\target/assembly/patches/karaf-instance.patch" originalfile="C:\Users\efaseel\odl_boron\genius\karaf4\target/assembly/bi
n/instance" failonerror="true"/>... @ 5:213 in C:\Users\efaseel\odl_boron\genius\karaf4\target\antrun\build-main.xml
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :genius-karaf4

Environment

Operating System: All
Platform: All

Activity

Show:

Michael Vorburger June 23, 2017 at 8:09 PM

> (a) doing the 'patch' earlier during the build

https://git.opendaylight.org/gerrit/#/c/59486/

Michael Vorburger June 19, 2017 at 1:20 PM

> if some day we can find a way to avoid that, it would be better

I guess "fixing" this would come down to either:

(a) doing the 'patch' earlier during the build, like have this happen during odlparent's build and keep the result as an artifact used by projects, without them have to run patch

(b) replacing https://ant.apache.org/manual/Tasks/patch.html with a pure Java implementation? In https://github.com/opendaylight/mdsal/blob/af55eed5432a28761ef474175933779de7f3a13e/binding/mdsal-binding-test-utils/src/main/java/org/opendaylight/mdsal/binding/testutils/DiffUtil.java (which is related to https://github.com/vorburger/xtendbeans) I've used a "difflib" found on Maven central which can do "diff" and AFAIK also "patch" in Java, so if someone is motivated to wrap that as an Ant task...

Stephen Kitt June 13, 2017 at 12:31 PM

(In reply to Michael Vorburger from comment #1)
> I'm not crystal clear on why this is a Karaf 4 specific problem (or is it
> not and locally building Karaf distributions never worked on Windows) -
> didn't we patch configuration files with Karaf 3 already? Or did we do it
> "earlier" there, during the odlparent build, not each project? (Would it be
> imaginable to do something similar for Karaf 4 again?)

We carried patched Karaf files in our repositories, which isn’t really maintainable in the long term. (Although I’m sure some people would argue over that — it really depends on how comfortable you are with patch management tools.)

Michael Vorburger June 13, 2017 at 10:45 AM

This is because https://ant.apache.org/manual/Tasks/patch.html 'requires "patch" to be on the execution path' - which Windows does not have.

Running ODL mvn under "Git Bash" <https://git-for-windows.github.io> on Windows, or Cygwin <https://www.cygwin.com> is a workaround to get around this (Bug reporter has confirmed on IRC this works for her).

I'm not crystal clear on why this is a Karaf 4 specific problem (or is it not and locally building Karaf distributions never worked on Windows) - didn't we patch configuration files with Karaf 3 already? Or did we do it "earlier" there, during the odlparent build, not each project? (Would it be imaginable to do something similar for Karaf 4 again?)

Linking, as Faseela found this in GENIUS-82 testing. It does not strictly "block" testing, as there is the described workaround - but at the least it's confusing to Windows users - if some day we can find a way to avoid that, it would be better.

Done

Details

Assignee

Reporter

External issue ID

Components

Affects versions

Priority

Created June 13, 2017 at 10:37 AM
Updated January 24, 2018 at 2:26 PM
Resolved July 4, 2017 at 9:34 AM