在ubuntu 14.04上构建maven项目时出现此错误。我的命令:mvn liferay:build-service compile package
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 compile package
许可但仍然无法解决这个问题,请帮帮我。
答案 0 :(得分:0)
该文件可能被另一个进程锁定:
执行“lsof /usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/mysql-connector-java-5.1.21.jar” 看看哪个进程可以对其进行独占锁定。