On Sat, 2003-08-23 at 06:49, Leo Sutic wrote:
> Hi all,
> 
> I have been trying Maven for the past week, and come up against two major
> difficulties:
> 
> 
> CODE GENERATOR
> --------------
> I have a code-generator task written for Ant that I'm trying to turn into
> a Maven plugin. Since it is a code generator, I need to do the following:
> 
>  1. Run the code generator.
> 
>  2. Compile the java source files and the files generated in step (1).
> 
> I thought that defining a preoal for java:compile would do the trick, and
> this actually worked:
> 
>  1. Use the maven.compile.src.set path to find source files, and feed
> these to the code generator.
> 
>  2. The code generator uses the maven.build.dir property to output a
> temporary source tree to ${maven.build.dir}/generated
> 
>  3. Add the ${maven.build.dir}/generated path to the maven.compile.src.set
> path via <maven:addPath/>.
> 
> Then the java:compile goal will kick in and compile the original java
> source files along with the newly generated ones. So far so good, then -
> but then I moved the above code into a plugin (I had had it in the
> maven.xml of my project first), and suddenly I discovered the following:
> 
>  + maven.compile.src.set no longer available.
> 
>  + Adding the ${maven.build.dir}/generated path to the
> maven.compile.src.set path via <maven:addPath/> doesn't work. When
> java:compile kicks in the change has been rolled back.
> 
> So my questions are:
> 
>  1. How can I access the maven.compile.src.set property from a plugin?
> 
>  2. How can I modify the maven.compile.src.set property from a plugin?

Look at the antlr plugin, there are examples of modifying
maven.compile.src.set. Basically antlr generates the specified sources
from a grammar and then appends the path containing the generated
sources to maven.compile.src.set.

> 
> JAR TOOL
> --------
> I also have a tool that operates on the produced JAR file. So I defined a
> postGoal for jar:jar, and figured I'd use the
> ${maven.build.dir}/${maven.final.name}.jar path to find the jar that was
> just produced. However, this turned out not to work in the case when
> jar:jar was called from jar:snapshot. The <j:set/> done in jar:snapshot to
> set the jar's name to the snapshotSignature isn't visible from the
> postGoal.
> 
> So my questions are:
> 
>  1. Is there an easy way to add any post-processing of the jar file
> created by jar:jar?

You can do a postGoal. Do you want to modify the contents before the JAR
is produced? Or didn't the JAR once it has been produced?

>  2. Is there any way to find out the path of the jar created in jar:jar?

It is always:

 <basedir>/target/${pom.artifactId}-${pom.currentVersion}.jar


> /LS
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
-- 
jvz.

Jason van Zyl
[EMAIL PROTECTED]
http://tambora.zenplex.org

In short, man creates for himself a new religion of a rational
and technical order to justify his work and to be justified in it.
  
  -- Jacques Ellul, The Technological Society


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

Reply via email to