【问题标题】:Javac not on path when running maven with the zinc incremental compiler (scala maven plugin) as a service使用锌增量编译器(scala maven插件)作为服务运行maven时Javac不在路径上
【发布时间】:2012-09-18 04:10:31
【问题描述】:

我是 maven scala 插件使用的锌增量编译器的忠实拥护者,但我发现每次启动笔记本电脑时都必须手动启动它很烦人。我编写了一个脚本来在 Ubuntu 中将它作为服务运行 - 它启动正常,但是当我运行 mvn install 时,我收到一个错误,指出它找不到程序 javac。下面是我在 /etc/init.d 中的脚本 - 注意:我指定了 $JAVA_HOME 并将其添加到 /etc/bash.bashrc 中的路径中,该路径在此脚本中明确来源。

#!/bin/bash

### BEGIN INIT INFO
# Provides:          zinc
# Required-Start:    $remote_fs $network
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start compiler at boot time
# Description:       Starts and stops the zinc incremental compiler
### END INIT INFO

source /etc/bash.bashrc
PROG_PATH="/opt/zinc/bin"
PROG="zinc" 

start() {
    su - gary "-c $PROG_PATH/$PROG -start 2>&1 >/dev/null &"
    echo "$PROG started"
}

stop() {
    su - gary "-c $PROG_PATH/$PROG -shutdown 2>&1 >/dev/null &"   
    echo "$PROG stopped"
}

## Check to see if we are running as root first.
if [ "$(id -u)" != "0" ]; then
    echo "This script must be run as root" 1>&2
    exit 1
fi

case "$1" in
    start)
        start
        exit 0
    ;;
    stop)
        stop
        exit 0
    ;;
    reload|restart|force-reload)
        stop
        start
        exit 0
    ;;
    **)
        echo "Usage: $0 {start|stop|reload}" 1>&2
        exit 1
    ;;
esac

【问题讨论】:

    标签: scala maven sbt javac


    【解决方案1】:

    Zinc 带有 -java-home 命令参数。你试过那个吗?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-01-14
      • 1970-01-01
      • 2018-06-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多