java - 无法执行目标 org.apache.maven.plugins(权限被拒绝)

标签 java maven

我在 ubuntu 14.04 上构建 Maven 项目时遇到此错误。我的命令:mvn liferay:build-service 编译包

Writing /home/hien/bitnemo/gtsportlets/gts-portlet-service/src/main/java/com/gts/portlets/eventdata/service/persistence/EventDataPersistence.java
    Writing /home/hien/bitnemo/gtsportlets/gts-portlet-service/src/main/java/com/gts/portlets/eventdata/service/persistence/EventDataUtil.java
    Writing /home/hien/bitnemo/gtsportlets/gts-portlet-service/src/main/java/com/gts/portlets/eventdata/model/EventDataWrapper.java
    Building EventOverSpeed
    Building EventPTO
    Building FnolDetail
    Building FnolMainEvent
    Building GeoCorridor
    Building GeoCorridorList
    Building Geozone
    Building Pushpins
    [INFO] 
    [INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ gts-portlet-service ---
    [debug] execute contextualize
    [INFO] Using 'UTF-8' encoding to copy filtered resources.
    [INFO] skip non existing resourceDirectory /home/hien/bitnemo/gtsportlets/gts-portlet-service/src/main/resources
    [INFO] 
    [INFO] --- maven-compiler-plugin:2.5:compile (default-compile) @ gts-portlet-service ---
    [INFO] Compiling 321 source files to /home/hien/bitnemo/gtsportlets/gts-portlet-service/target/classes
    [INFO] -------------------------------------------------------------
    [ERROR] COMPILATION ERROR : 
    [INFO] -------------------------------------------------------------
    [ERROR] error: error reading /usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/mysql-connector-java-5.1.21.jar; /usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/mysql-connector-java-5.1.21.jar (Permission denied)
    [INFO] 1 error
    [INFO] -------------------------------------------------------------
    [INFO] ------------------------------------------------------------------------
    [INFO] Reactor Summary:
    [INFO] 
    [INFO] gts ............................................... SUCCESS [  1.263 s]
    [INFO] gts Portlet Service ............................... FAILURE [02:23 min]
    [INFO] WTP Portlet ....................................... SKIPPED
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 02:25 min
    [INFO] Finished at: 2014-10-23T08:53:09+07:00
    [INFO] Final Memory: 56M/263M
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5:compile (default-compile) on project gts-portlet-service: Compilation failure
    [ERROR] error: error reading /usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/mysql-connector-java-5.1.21.jar; /usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/mysql-connector-java-5.1.21.jar (Permission denied)
    [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/MojoFailureException
    [ERROR] 
    [ERROR] After correcting the problems, you can resume the build with the command
    [ERROR]   mvn <goals> -rf :gts-portlet-service
    hien@hien-eME730G:~/bitnemo/gtsportlets$ sudo mvn liferay:build-service compile package
    [INFO] Scanning for projects...
    [ERROR] The build could not read 1 project -> [Help 1]
    [ERROR]   
    [ERROR]   The project com.example.plugins:gts:1.0.0-SNAPSHOT (/home/hien/bitnemo/gtsportlets/pom.xml) has 1 error
    [ERROR]     'build.plugins.plugin.version' for com.liferay.maven.plugins:liferay-maven-plugin must be a valid version but is '${liferay.maven.plugin.version}'. @ line 16, column 14
    [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/ProjectBuildingException

之后,我使用 sudo 运行: $sudo mvn liferay:build-service 编译包 许可但仍然无法解决这个问题,请帮助我。

最佳答案

该文件可能被另一个进程锁定:

执行“lsof/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/mysql-connector-java-5.1.21.jar” 查看哪个进程可能持有其独占锁。

关于java - 无法执行目标 org.apache.maven.plugins(权限被拒绝),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26520209/

相关文章:

java - 将 XML 字符串解析为数组字符串

json - Jersey 2.x 使用 Pojo 作为 POST 的参数

maven - hadoop-core.jar 中不存在 org.apache.hadoop.conf.Configuration

java - "Using Maven 2 dependency tree to get verbose output, which may be inconsistent with actual Maven 3 resolution"

java - Maven - 无法解析项目 X 的​​依赖关系

java - MAVEN 构建失败 - 无法解决项目 XYZ 的依赖关系

java - 设置 Activity 向上按钮

java - 减去圆弧的内半径/部分以实现环形进度条

java - 无法在基本类型 double 上调用 toString()

java - 正则表达式获取“符号”之间的文本