[m2] Antrun / Javac

2005-12-23 Thread Giles, Nick
I'm having distinct problems with the Antrun plugin for Maven2,
specifically with the inheritance of properties and environment
variables. With a simple test where the pom.xml calls a build.xml, which
then uses javac, Ant complains about not being able to find
com.sun.tools.javac.Main on the classpath. This isn't the usual Ant
problem that gives that message, because Ant will run fine from the
command line, it's an inheritance from Maven problem. With the files
described below, I get a negligible classpath in the Maven part of the
operation, and a null classpath in the Ant part. If I run the buildfile
from the commandline, I get a full and proper classpath, and execution
works.

Does anyone have any idea how I can get this to work, and why it does
work in one of my projects, but I'm scared to change it to try and find
out why, because I'll never get it back to working again...

Cheers,

Nick



Pom.xml:

project xmlns=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;
  modelVersion4.0.0/modelVersion
  groupIdworkbench/groupId
  artifactIdworkbench/artifactId
  packagingjar/packaging
  version1.0-SNAPSHOT/version


  build
sourceDirectory./sourceDirectory
plugins
  plugin
groupIdorg.apache.maven.plugins/groupId
artifactIdmaven-antrun-plugin/artifactId
executions
  execution
phasegenerate-sources/phase
configuration
  tasks
echo message=Classpath in Antrun task =
${java.class.path}/
ant antfile=build.xml dir=. inheritAll=true 
/ant
  /tasks
/configuration
goals
  goalrun/goal
/goals
  /execution
/executions
  /plugin
/plugins
  /build

/project

==

Build.xml:

project name=Workbench default=run basedir=.

  target name=run depends=clean,compile
java classname=Workbench /
  /target

  target name=compile
echo message=Classpath in Ant: ${java.class.path} /
javac srcdir=. /
  /target

  target name=clean
delete
  fileset dir=.
include name=*.class /
  /fileset
/delete
  /target

/project


=

Workbench.java:


public class Workbench {

public static void main(String[] args) {
System.out.println(Hello);
}

}
 
   This message may contain privileged and/or confidential information.  If 
you have received this e-mail in error or are not the intended recipient, you 
may not use, copy, disseminate or distribute it; do not open any attachments, 
delete it immediately from your system and notify the sender promptly by e-mail 
that you have done so.  Thank you.

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



RE: [m2] Antrun / Javac

2005-12-23 Thread Scokart Gilles
Here is an example of doing wath you want, I think.

plugin
artifactIdmaven-antrun-plugin/artifactId
executions
execution
phasegenerate-test-sources/phase
configuration
tasks
ant
antfile=src/test/ant/build.xml inheritRefs=true/
/tasks

testSourceRoottarget/generated-sources/nextmock/testSourceRoot
/configuration
goals
goalrun/goal
/goals
/execution
/executions
dependencies
dependency
groupIdsun.jdk/groupId
artifactIdtools/artifactId
version1.5/version
scopesystem/scope
systemPath${java.home}/../lib/tools.jar/systemPath
/dependency
/dependencies
/plugin



 -Original Message-
 From: Giles, Nick [mailto:[EMAIL PROTECTED]
 Sent: 23 December 2005 11:51
 To: users@maven.apache.org
 Subject: [m2] Antrun / Javac
 
 I'm having distinct problems with the Antrun plugin for Maven2,
 specifically with the inheritance of properties and environment
 variables. With a simple test where the pom.xml calls a build.xml, which
 then uses javac, Ant complains about not being able to find
 com.sun.tools.javac.Main on the classpath. This isn't the usual Ant
 problem that gives that message, because Ant will run fine from the
 command line, it's an inheritance from Maven problem. With the files
 described below, I get a negligible classpath in the Maven part of the
 operation, and a null classpath in the Ant part. If I run the buildfile
 from the commandline, I get a full and proper classpath, and execution
 works.
 
 Does anyone have any idea how I can get this to work, and why it does
 work in one of my projects, but I'm scared to change it to try and find
 out why, because I'll never get it back to working again...
 
 Cheers,
 
 Nick
 
 
 
 Pom.xml:
 
 project xmlns=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;
   modelVersion4.0.0/modelVersion
   groupIdworkbench/groupId
   artifactIdworkbench/artifactId
   packagingjar/packaging
   version1.0-SNAPSHOT/version
 
 
   build
 sourceDirectory./sourceDirectory
 plugins
   plugin
 groupIdorg.apache.maven.plugins/groupId
   artifactIdmaven-antrun-plugin/artifactId
   executions
   execution
 phasegenerate-sources/phase
 configuration
   tasks
   echo message=Classpath in Antrun task =
 ${java.class.path}/
   ant antfile=build.xml dir=. inheritAll=true 
 /ant
   /tasks
 /configuration
 goals
   goalrun/goal
 /goals
   /execution
 /executions
   /plugin
 /plugins
   /build
 
 /project
 
 ==
 
 Build.xml:
 
 project name=Workbench default=run basedir=.
 
   target name=run depends=clean,compile
 java classname=Workbench /
   /target
 
   target name=compile
 echo message=Classpath in Ant: ${java.class.path} /
 javac srcdir=. /
   /target
 
   target name=clean
 delete
   fileset dir=.
 include name=*.class /
   /fileset
 /delete
   /target
 
 /project
 
 
 =
 
 Workbench.java:
 
 
 public class Workbench {
 
 public static void main(String[] args) {
   System.out.println(Hello);
 }
 
 }
 
This message may contain privileged and/or confidential
 information.  If you have received this e-mail in error or are not the
 intended recipient, you may not use, copy, disseminate or distribute it;
 do not open any attachments, delete it immediately from your system and
 notify the sender promptly by e-mail that you have done so.  Thank you.
 
 -
 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]



RE: [m2] Antrun / Javac

2005-12-23 Thread Giles, Nick
Thanks, the system dependency worked a treat. I'm surprised that the
plugin needs it though...

Cheers,

Nick

-Original Message-
From: Scokart Gilles [mailto:[EMAIL PROTECTED] 
Sent: 23 December 2005 12:24
To: Maven Users List
Subject: RE: [m2] Antrun / Javac

Here is an example of doing wath you want, I think.

plugin
artifactIdmaven-antrun-plugin/artifactId
executions
execution
phasegenerate-test-sources/phase
configuration
tasks
ant
antfile=src/test/ant/build.xml inheritRefs=true/
/tasks

testSourceRoottarget/generated-sources/nextmock/testSourceRoot
/configuration
goals
goalrun/goal
/goals
/execution
/executions
dependencies
dependency
groupIdsun.jdk/groupId
artifactIdtools/artifactId
version1.5/version
scopesystem/scope
systemPath${java.home}/../lib/tools.jar/systemPath
/dependency
/dependencies
/plugin



 -Original Message-
 From: Giles, Nick [mailto:[EMAIL PROTECTED]
 Sent: 23 December 2005 11:51
 To: users@maven.apache.org
 Subject: [m2] Antrun / Javac
 
 I'm having distinct problems with the Antrun plugin for Maven2, 
 specifically with the inheritance of properties and environment 
 variables. With a simple test where the pom.xml calls a build.xml, 
 which then uses javac, Ant complains about not being able to find 
 com.sun.tools.javac.Main on the classpath. This isn't the usual Ant 
 problem that gives that message, because Ant will run fine from the 
 command line, it's an inheritance from Maven problem. With the files 
 described below, I get a negligible classpath in the Maven part of the

 operation, and a null classpath in the Ant part. If I run the 
 buildfile from the commandline, I get a full and proper classpath, and

 execution works.
 
 Does anyone have any idea how I can get this to work, and why it does 
 work in one of my projects, but I'm scared to change it to try and 
 find out why, because I'll never get it back to working again...
 
 Cheers,
 
 Nick
 
 
 
 Pom.xml:
 
 project xmlns=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;
   modelVersion4.0.0/modelVersion
   groupIdworkbench/groupId
   artifactIdworkbench/artifactId
   packagingjar/packaging
   version1.0-SNAPSHOT/version
 
 
   build
 sourceDirectory./sourceDirectory
 plugins
   plugin
 groupIdorg.apache.maven.plugins/groupId
   artifactIdmaven-antrun-plugin/artifactId
   executions
   execution
 phasegenerate-sources/phase
 configuration
   tasks
   echo message=Classpath in Antrun task = 
 ${java.class.path}/
   ant antfile=build.xml dir=. inheritAll=true 
 /ant
   /tasks
 /configuration
 goals
   goalrun/goal
 /goals
   /execution
 /executions
   /plugin
 /plugins
   /build
 
 /project
 
 ==
 
 Build.xml:
 
 project name=Workbench default=run basedir=.
 
   target name=run depends=clean,compile
 java classname=Workbench /
   /target
 
   target name=compile
 echo message=Classpath in Ant: ${java.class.path} /
 javac srcdir=. /
   /target
 
   target name=clean
 delete
   fileset dir=.
 include name=*.class /
   /fileset
 /delete
   /target
 
 /project
 
 
 =
 
 Workbench.java:
 
 
 public class Workbench {
 
 public static void main(String[] args) {
   System.out.println(Hello);
 }
 
 }
 
This message may contain privileged and/or confidential 
 information.  If you have received this e-mail in error or are not the

 intended recipient, you may not use, copy, disseminate or distribute 
 it; do not open any attachments, delete it immediately from your 
 system and notify the sender promptly by e-mail that you have done so.
Thank you.
 
 -
 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]
 
   This message may contain privileged and/or confidential information.  If 
you have received this e-mail in error or are not the intended recipient, you 
may not use, copy, disseminate or distribute it; do not open any attachments, 
delete it immediately from your system and notify the sender promptly by e-mail

Re: [m2] Antrun / Javac

2005-12-23 Thread Chris Berry
Actually, I think this is a bug in the antrun Plugin. Ant, by definition,
should have system properties available to it -- such as the ${
java.class.path} property you require or ${user.home} or whatever.

In my local version of antrun I had to do the following fix in
org.apache.maven.plugin.antrun.components.AntTargetConverter

// 
//initDefinitions( project, target );
project.init();
//

so that it properly initializes the Ant project.
Cheers,
-- Chris


On 12/23/05, Giles, Nick [EMAIL PROTECTED] wrote:

 Thanks, the system dependency worked a treat. I'm surprised that the
 plugin needs it though...

 Cheers,

 Nick

 -Original Message-
 From: Scokart Gilles [mailto:[EMAIL PROTECTED]
 Sent: 23 December 2005 12:24
 To: Maven Users List
 Subject: RE: [m2] Antrun / Javac

 Here is an example of doing wath you want, I think.

 plugin
 artifactIdmaven-antrun-plugin/artifactId
 executions
 execution
 phasegenerate-test-sources/phase
 configuration
 tasks
 ant
 antfile=src/test/ant/build.xml inheritRefs=true/
 /tasks

 testSourceRoottarget/generated-sources/nextmock/testSourceRoot
 /configuration
 goals
 goalrun/goal
 /goals
 /execution
 /executions
 dependencies
 dependency
 groupIdsun.jdk/groupId
 artifactIdtools/artifactId
 version1.5/version
 scopesystem/scope
 systemPath${java.home}/../lib/tools.jar/systemPath
 /dependency
 /dependencies
 /plugin



  -Original Message-
  From: Giles, Nick [mailto:[EMAIL PROTECTED]
  Sent: 23 December 2005 11:51
  To: users@maven.apache.org
  Subject: [m2] Antrun / Javac
 
  I'm having distinct problems with the Antrun plugin for Maven2,
  specifically with the inheritance of properties and environment
  variables. With a simple test where the pom.xml calls a build.xml,
  which then uses javac, Ant complains about not being able to find
  com.sun.tools.javac.Main on the classpath. This isn't the usual Ant
  problem that gives that message, because Ant will run fine from the
  command line, it's an inheritance from Maven problem. With the files
  described below, I get a negligible classpath in the Maven part of the

  operation, and a null classpath in the Ant part. If I run the
  buildfile from the commandline, I get a full and proper classpath, and

  execution works.
 
  Does anyone have any idea how I can get this to work, and why it does
  work in one of my projects, but I'm scared to change it to try and
  find out why, because I'll never get it back to working again...
 
  Cheers,
 
  Nick
 
  
 
  Pom.xml:
 
  project xmlns=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;
modelVersion4.0.0/modelVersion
groupIdworkbench/groupId
artifactIdworkbench/artifactId
packagingjar/packaging
version1.0-SNAPSHOT/version
 
 
build
  sourceDirectory./sourceDirectory
  plugins
plugin
  groupIdorg.apache.maven.plugins/groupId
artifactIdmaven-antrun-plugin/artifactId
executions
execution
  phasegenerate-sources/phase
  configuration
tasks
echo message=Classpath in Antrun task =
  ${java.class.path}/
ant antfile=build.xml dir=. inheritAll=true 
  /ant
/tasks
  /configuration
  goals
goalrun/goal
  /goals
/execution
  /executions
/plugin
  /plugins
/build
 
  /project
 
  ==
 
  Build.xml:
 
  project name=Workbench default=run basedir=.
 
target name=run depends=clean,compile
  java classname=Workbench /
/target
 
target name=compile
  echo message=Classpath in Ant: ${java.class.path} /
  javac srcdir=. /
/target
 
target name=clean
  delete
fileset dir=.
  include name=*.class /
/fileset
  /delete
/target
 
  /project
 
 
  =
 
  Workbench.java:
 
 
  public class Workbench {
 
  public static void main(String[] args) {
System.out.println(Hello);
  }
 
  }
 
 This message may contain privileged and/or confidential
  information.  If you have received this e-mail in error or are not the

  intended recipient, you may not use, copy, disseminate or distribute
  it; do not open any attachments, delete it immediately from your
  system and notify the sender promptly by e-mail that you have done so.
 Thank you

Re: [m2] Antrun / Javac

2005-12-23 Thread dan tran
Chris, can you file a JIRA and send the patch in? ;-)

On 12/23/05, Chris Berry [EMAIL PROTECTED] wrote:

 Actually, I think this is a bug in the antrun Plugin. Ant, by definition,
 should have system properties available to it -- such as the ${
 java.class.path} property you require or ${user.home} or whatever.

 In my local version of antrun I had to do the following fix in
 org.apache.maven.plugin.antrun.components.AntTargetConverter

// 
//initDefinitions( project, target );
project.init();
//

 so that it properly initializes the Ant project.
 Cheers,
 -- Chris


 On 12/23/05, Giles, Nick [EMAIL PROTECTED] wrote:
 
  Thanks, the system dependency worked a treat. I'm surprised that the
  plugin needs it though...
 
  Cheers,
 
  Nick
 
  -Original Message-
  From: Scokart Gilles [mailto:[EMAIL PROTECTED]
  Sent: 23 December 2005 12:24
  To: Maven Users List
  Subject: RE: [m2] Antrun / Javac
 
  Here is an example of doing wath you want, I think.
 
  plugin
  artifactIdmaven-antrun-plugin/artifactId
  executions
  execution
  phasegenerate-test-sources/phase
  configuration
  tasks
  ant
  antfile=src/test/ant/build.xml inheritRefs=true/
  /tasks
 
  testSourceRoottarget/generated-sources/nextmock/testSourceRoot
  /configuration
  goals
  goalrun/goal
  /goals
  /execution
  /executions
  dependencies
  dependency
  groupIdsun.jdk/groupId
  artifactIdtools/artifactId
  version1.5/version
  scopesystem/scope
  systemPath${java.home}/../lib/tools.jar/systemPath
  /dependency
  /dependencies
  /plugin
 
 
 
   -Original Message-
   From: Giles, Nick [mailto:[EMAIL PROTECTED]
   Sent: 23 December 2005 11:51
   To: users@maven.apache.org
   Subject: [m2] Antrun / Javac
  
   I'm having distinct problems with the Antrun plugin for Maven2,
   specifically with the inheritance of properties and environment
   variables. With a simple test where the pom.xml calls a build.xml,
   which then uses javac, Ant complains about not being able to find
   com.sun.tools.javac.Main on the classpath. This isn't the usual Ant
   problem that gives that message, because Ant will run fine from the
   command line, it's an inheritance from Maven problem. With the files
   described below, I get a negligible classpath in the Maven part of the
 
   operation, and a null classpath in the Ant part. If I run the
   buildfile from the commandline, I get a full and proper classpath, and
 
   execution works.
  
   Does anyone have any idea how I can get this to work, and why it does
   work in one of my projects, but I'm scared to change it to try and
   find out why, because I'll never get it back to working again...
  
   Cheers,
  
   Nick
  
   
  
   Pom.xml:
  
   project xmlns=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;
 modelVersion4.0.0/modelVersion
 groupIdworkbench/groupId
 artifactIdworkbench/artifactId
 packagingjar/packaging
 version1.0-SNAPSHOT/version
  
  
 build
   sourceDirectory./sourceDirectory
   plugins
 plugin
   groupIdorg.apache.maven.plugins/groupId
 artifactIdmaven-antrun-plugin/artifactId
 executions
 execution
   phasegenerate-sources/phase
   configuration
 tasks
 echo message=Classpath in Antrun task =
   ${java.class.path}/
 ant antfile=build.xml dir=. inheritAll=true 
   /ant
 /tasks
   /configuration
   goals
 goalrun/goal
   /goals
 /execution
   /executions
 /plugin
   /plugins
 /build
  
   /project
  
   ==
  
   Build.xml:
  
   project name=Workbench default=run basedir=.
  
 target name=run depends=clean,compile
   java classname=Workbench /
 /target
  
 target name=compile
   echo message=Classpath in Ant: ${java.class.path} /
   javac srcdir=. /
 /target
  
 target name=clean
   delete
 fileset dir=.
   include name=*.class /
 /fileset
   /delete
 /target
  
   /project
  
  
   =
  
   Workbench.java:
  
  
   public class Workbench {
  
   public static void main(String[] args) {
 System.out.println(Hello);
   }
  
   }
  
  This message may contain privileged and/or confidential
   information.  If you have