[英]Maven with Ant wrapper error - main class path
I'm attempting to compile my companies codebase using Maven which is wrapped in an Ant launcher for backwards compatibility reasons. 我正在尝试使用Maven编译我的公司代码库,该Maven出于向后兼容的原因而包装在Ant启动器中。 I am running Oracle Linux 6.6, Java 1.7 u79-b14, Ant 1.7.1 and Maven 3.0.5 which are versions dictated to me by the enterprise infrastructure team.
我正在运行Oracle Linux 6.6,Java 1.7 u79-b14,Ant 1.7.1和Maven 3.0.5,它们是企业基础架构团队指定给我的版本。
When I set JAVA_HOME
I get the following error when executing Ant Error: Could not find or load main class org.apache.tools.ant.launch.Launcher
but if JAVA_HOME
is commented out then Ant seems to run just fine. 当我设置
JAVA_HOME
时,在执行Ant Error: Could not find or load main class org.apache.tools.ant.launch.Launcher
时出现以下Error: Could not find or load main class org.apache.tools.ant.launch.Launcher
但是如果注释掉JAVA_HOME
,则Ant看起来可以正常运行。
#~/.bashrc
export JAVA_HOME=/usr/lib/jvm/jre-1.7.0-openjdk.x86_64
export MAVEN_HOME=/usr/share/maven
export M2_HOME=/usr/share/maven
export MAVEN_OPTS="-Xmx1024m"
export BUILD_CHROOT="/home/builduser/builds"
Included to help is the location at which Java is installed. 包含帮助的是Java的安装位置。
[builduser@iaas-a-jen03 ~]$ which java
/usr/bin/java
[builduser@iaas-a-jen03 ~]$ ls -la /usr/bin/java
lrwxrwxrwx 1 root root 22 Jun 30 11:58 /usr/bin/java -> /etc/alternatives/java
[builduser@iaas-a-jen03 ~]$ ls -la /etc/alternatives/java
lrwxrwxrwx 1 root root 46 Jun 30 11:58 /etc/alternatives/java -> /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java
The issue was resolved by following the steps found in this blog post... http://pkolomeitsev.blogspot.co.uk/2015/01/apache-ant-error-could-not-find-or-load.html 通过遵循此博客文章中的步骤解决了该问题... http://pkolomeitsev.blogspot.co.uk/2015/01/apache-ant-error-could-not-find-or-load.html
ant --execdebug
was the key to creating the right folders. ant --execdebug
是创建正确文件夹的关键。 Then I just had to make sure that java-1.7.0-openjdk-devel.x86_46
was installed and voila! 然后,我只需要确保已安装
java-1.7.0-openjdk-devel.x86_46
即可!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.