Are you sure that there is not another JAVA_HOME environment variable
defined; maybe like a system-level one? Or maybe something else weird
in your PATH variable?
-Bill Siggelkow
On Dec 2, 2005, at 9:53 AM, Matthew Wheaton wrote:
A little background first.
I've been using Maven even before the 1.0 release, and have been
very happy
with it. I've created very complex builds and have a very good working
knowledge of Maven 1.x. The structure I describe below, is
precisely how
I've successfully built projects with Maven 1.x countless times.
I'm starting a whole new project, and would like to see if Maven 2
is going
to be something I want to use.
Now on to my problem. Maven 2 cannot find the Javac Compiler that I
believe
I pointed it to.
I'm running the latest Maven download, version 2.0, on Windows XP
I've created two project modules :
csi_build
csi_common
csi_common contains my first simple project I'd like to build with
Maven 2
csi_build contains my Maven 2 binaries, AND a number of JDKs I use
for
builds. I store my JDKs in version control (Subversion), as some
deployments
require different versions of the JDK and because I want anyone to
be able
to pull down the latest code from the repository and immediately be
able to
execute a build, even if they don't have the JDK installed.
I simply go to the csi_common directory and execute the following
build.batfile
===
echo off
set
JAVA_HOME=C:\CSI\eclipse_workspaces\CSI\csi_build\src\tools\jdk
\jdk1.5.0_04
set
MAVEN_HOME=C:\CSI\eclipse_workspaces\CSI\csi_build\src\tools\maven
\maven-2.0
set PATH=%JAVA_HOME%\bin;%MAVEN_HOME%\bin;%PATH%
echo PATH=%PATH%
mvn package -e
===
Here's my simple pom.xml for csi_common
===
http://maven.apache.org/POM/4.0.0"; xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd";>
4.0.0
com.csi.common
csi_common
jar
1.0-SNAPSHOT
Maven Quick Start Archetype
http://maven.apache.org
src/java
junit
junit
3.8.1
test
===
The output complains "Unable to locate the Javac Compiler in:
C:\jre1.5.0_04\..\lib\tools.jar"
Here's the output:
===
C:\CSI\eclipse_workspaces\CSI\csi_common>echo off
PATH=C:\CSI\eclipse_workspaces\CSI\csi_build\src\tools\jdk
\jdk1.5.0_04\bin;
C:\CSI\eclipse_workspaces\CSI\csi_build\src\tools\maven\maven-2.0\bin;
C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem
+ Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO]
--
--
[INFO] Building Maven Quick Start Archetype
[INFO]task-segment: [package]
[INFO]
--
--
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:compile]
Compiling 4 source files to
C:\CSI\eclipse_workspaces\CSI\csi_common\target\classes
[INFO]
--
--
[ERROR] BUILD FAILURE
[INFO]
--
--
[INFO] Compilation failure
Unable to locate the Javac Compiler in:
C:\jre1.5.0_04\..\lib\tools.jar
Please ensure you are using JDK 1.4 or above and
not a JRE (the com.sun.tools.javac.Main class is required).
In most cases you can change the location of your Java
installation by setting the JAVA_HOME environment variable.
[INFO]
--
--
[INFO] Trace
org.apache.maven.BuildFailureException: Compilation failure
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(
DefaultLifecycleExecutor.java:540)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLif
ecycle
(DefaultLifecycleExecutor.java:469)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(
DefaultLifecycleExecutor.java:448)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHand
leFailures
(DefaultLifecycleExecutor.java:301)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegment
s(
DefaultLifecycleExecutor.java:268)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(
DefaultLifecycleExecutor.java:137)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:316)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:113)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:249)
at sun.reflect.NativeMethodAccessorImpl.invok