[
https://issues.apache.org/jira/browse/OPENNLP-1568?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17855432#comment-17855432
]
ASF GitHub Bot commented on OPENNLP-1568:
-----------------------------------------
veita commented on code in PR #607:
URL: https://github.com/apache/opennlp/pull/607#discussion_r1641947136
##########
opennlp-brat-annotator/src/main/bin/brat-annotation-service:
##########
@@ -21,6 +21,28 @@
# may be inadvertantly placed in any output files if
# output redirection is used.
+# determine OPENNLP_HOME - $0 may be a symlink to OpenNLP's home
+PRG="$0"
+
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG="`dirname "$PRG"`/$link"
+ fi
+done
Review Comment:
This is portable and well-proven code also used by other Apache projects
like Ant, Maven or Groovy. `realpath` and `pushd` are not portable.
> opennlp command fails when invoked from outside $OPENNLP_HOME/bin directory
> ---------------------------------------------------------------------------
>
> Key: OPENNLP-1568
> URL: https://issues.apache.org/jira/browse/OPENNLP-1568
> Project: OpenNLP
> Issue Type: Bug
> Components: Command Line Interface
> Affects Versions: 2.3.3
> Environment: Linux/Bash
> Reporter: Alexander Veit
> Priority: Major
>
> Try to run the opennlp command from outside $OPENNLP_HOME/bin directory.
> It fails with an error message similar to
>
> {noformat}
> 2024-06-15T22:44:04.900344345Z main ERROR Reconfiguration failed:
> No configuration found for '4f2410ac' at 'null' in 'null'{noformat}
>
> The error is caused by the relative path in
> {code:java}
> -Dlog4j.configurationFile=../conf/log4j2.xml {code}
> of the opennlp script.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)