[ODLPARENT-101] Karaf 4 distribution local build fails on Windows (missing "patch") Created: 13/Jun/17  Updated: 24/Jan/18  Resolved: 04/Jul/17

Status: Resolved
Project: odlparent
Component/s: General
Affects Version/s: 2.0.5
Fix Version/s: None

Type: Bug
Reporter: Faseela K Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: All
Platform: All


Issue Links:
Blocks
blocks GENIUS-82 Karaf4 specific problems seen on both... Resolved
External issue ID: 8677

 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



 Comments   
Comment by Michael Vorburger [ 13/Jun/17 ]

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.

Comment by Stephen Kitt [ 13/Jun/17 ]

(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.)

Comment by Michael Vorburger [ 19/Jun/17 ]

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

Comment by Michael Vorburger [ 23/Jun/17 ]

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

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

Comment by Michael Vorburger [ 04/Jul/17 ]

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

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

Generated at Wed Feb 07 20:27:38 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.