There is a bug such that if you have a child build which uses the ant
plugin it inherits the plugin dependencies of the first time the plugin
is declared.

The workaround is to put the antrun plugin in the toplevel, and add the
java jar to its plugin dependencies.

Ruel Loehr
JBoss QA
 
-----Original Message-----
From: Grothaus, Christoph [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, February 14, 2006 4:36 AM
To: Maven Users List
Subject: RE: [m2] Antrun-Plugin <javac> not working

UPDATE:

Now I managed to get the <javac> task working by setting the "fork"
attribute to "true". After the <javac> task I also have a <rmic> task,
and now that one fails.

Message: Embedded error: Cannot use SUN rmic, as it is not available.  A
common solution is to set the environment variable JAVA_HOME or
CLASSPATH.

The <rmic> task has no fork attribute, so no analogous solution here :-(


But this behaviour leads me to a new assumption: as this stuff used to
run before yesterday, and as it still runs as a single module, have
there recently been any changes on how maven treats environment
variables in a reactor build? It seems that maven does not propagate
environment to child modules, so the <rmic> task does not see JAVA_HOME,
and thus does not find the rmic executable.

How do I get around that?


Regards, Christoph



-----Original Message-----
From: Grothaus, Christoph [mailto:[EMAIL PROTECTED]
Sent: Tuesday, February 14, 2006 11:04 AM
To: [email protected]
Subject: [m2] Antrun-Plugin <javac> not working


Hi there,

I have a problem here that didn't occur until yesterday. Have there been
made any changes to the maven-antrun-plugin or to how maven handles
classpaths?

Situation: I have a multi-module J2EE project. In the EJB module I
compile an EJB client, not with the maven-ejb-plugin, as it doesn't fit
my needs, but with the antrun plugin. It's just the usual Ant <javac>
task. You can see the way I call the antrun plugin below, in the INPUT
section.

Now what is strange: when I cd directly to the module and then call "mvn
clean compile", everything works fine. When I cd to the project top
level directory and start a reactor build with "mvn clean compile", I
get an error that Ant is "Unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath." 

Why that??? Look at my debug echo message I've put into the ant script,
the output is in the OUTPUT section. In the output you can clearly see
that the last entry of the classpath is tools.jar, and yes, the location
is correct.


I'm desperate. Anyone any hints?

Christoph



------8<----Attachments-------------------------------------------------
------


############################################
# INPUT
############################################


<plugin>
  <!--
    ################
    build EJB-Client
    ################
  -->
  <artifactId>maven-antrun-plugin</artifactId>
  <executions>
    <execution>
      <id>ejb-client-compile</id>
      <phase>compile</phase>
      <configuration>
        <tasks>
          <property environment="env" />
          <path id="ejb-client.classpath">
            <path refid="maven.plugin.classpath" />
            <path refid="maven.compile.classpath" />
            <!-- 
              WORKAROUND
            -->
            <fileset dir="${env.JAVA_HOME}/lib">
              <include name="tools.jar" />
            </fileset>
          </path>
          
          <property name="prop.ejb-client.classpath"
refid="ejb-client.classpath" />
          <echo message="[DEBUG] The classpath is:
${prop.ejb-client.classpath}" />

   [...]
          
          <mkdir dir="${ejb-client.destdir}" />
          <javac destdir="${ejb-client.destdir}"
classpathref="ejb-client.classpath"
              debug="${javac.debug}" deprecation="on" optimize="off"
target="${javac.target}">
            <src path="${ejb-client.sourcedir}" />
          </javac>
        
        </tasks>
      </configuration>
      <goals>
        <goal>run</goal>
      </goals>
    </execution>
  </executions>
</plugin>





############################################
# OUTPUT
############################################

   [...]

[INFO] [antrun:run {execution: ejb-client-compile}]
[INFO] Executing tasks
     [echo] [DEBUG] The classpath is:
D:\ENTWICKLUNGSPROGRAMME\maven-local-repository\ant\ant-nodeps\1.6.5\ant
-nodeps-1.6.5.jar;D:\ENTWICKLUNGSPROGRAMME\maven-local-repository\ant\an
t\1.6.5\ant-1.6.5.jar;D:\ENTWICKLUNGSPROGRAMME\maven-local-repository\an
t\ant-launcher\1.6.5\ant-launcher-1.6.5.jar;D:\ENTWICKLUNGSPROGRAMME\mav
en-2.0.2\lib\maven-project-2.0.2.jar;D:\ENTWICKLUNGSPROGRAMME\maven-2.0.
2\lib\maven-plugin-api-2.0.2.jar;D:\ENTWICKLUNGSPROGRAMME\MAVENENTWICKLU
NG\basel2maven\server\modules\ejb\generic\target\classes;D:\ENTWICKLUNGS
PROGRAMME\maven-local-repository\org\hibernate\hibernate\3.0.5\hibernate
-3.0.5.jar;D:\ENTWICKLUNGSPROGRAMME\maven-local-repository\asm\asm-util\
1.3.4\asm-util-1.3.4.jar;D:\ENTWICKLUNGSPROGRAMME\maven-local-repository
\cglib\cglib\2.1\cglib-2.1.jar;D:\ENTWICKLUNGSPROGRAMME\maven-local-repo
sitory\log4j\log4j\1.2.8\log4j-1.2.8.jar;D:\ENTWICKLUNGSPROGRAMME\maven-
local-repository\commons-logging\commons-logging\1.0.4\commons-logging-1
.0.4.jar;D:\ENTWICKLUNGSPROGRAMME\maven-local-repository\dom4j\dom4j\1.6
\dom4j-1.6.jar;D:\ENTWICKLUNGSPROGRAMME\maven-local-repository\ehcache\e
hcache\1.1\ehcache-1.1.jar;D:\ENTWICKLUNGSPROGRAMME\maven-local-reposito
ry\commons-lang\commons-lang\2.0\commons-lang-2.0.jar;D:\ENTWICKLUNGSPRO
GRAMME\maven-local-repository\asm\asm-attrs\1.5.3\asm-attrs-1.5.3.jar;D:
\ENTWICKLUNGSPROGRAMME\maven-local-repository\rhino\js\1.6R2\js-1.6R2.ja
r;D:\ENTWICKLUNGSPROGRAMME\maven-local-repository\javax\j2ee\j2ee\1.3.1\
j2ee-1.3.1.jar;D:\ENTWICKLUNGSPROGRAMME\maven-local-repository\asm\asm\1
.5.3\asm-1.5.3.jar;D:\ENTWICKLUNGSPROGRAMME\maven-local-repository\commo
ns-collections\commons-collections\2.1.1\commons-collections-2.1.1.jar;D
:\ENTWICKLUNGSPROGRAMME\maven-local-repository\aspectwerkz\aspectwerkz-c
ore\0.8.1\aspectwerkz-core-0.8.1.jar;D:\ENTWICKLUNGSPROGRAMME\maven-loca
l-repository\de\zeb\license-manager\1.0\license-manager-1.0.jar;D:\ENTWI
CKLUNGSPROGRAMME\MAVENENTWICKLUNG\basel2maven\server\modules\properties\
target\classes;D:\ENTWICKLUNGSPROGRAMME\maven-local-repository\hibernate
\antlr\2.7.5H3\antlr-2.7.5H3.jar;D:\ENTWICKLUNGSPROGRAMME\java\j2sdk1.4.
2_05\lib\tools.jar
    [javac] Compiling 21 source files to
D:\ENTWICKLUNGSPROGRAMME\MAVENENTWICKLUNG\basel2maven\server\modules\ejb
\generic\target\ejb-client-classes
[INFO]
------------------------------------------------------------------------
----
[ERROR] BUILD ERROR
[INFO]
------------------------------------------------------------------------
----
[INFO] Error executing ant tasks

Embedded error: Unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to