Re: Improving Maven Site Docs

2007-09-27 Thread Kevin Jackson
Hi,

Regarding the XML thing (OT wrt documentation - sorry).

XML basically sucks as a human readable format, it's a more verbose
form of tree/list syntax (like s-expr).

One problem I have with mvn that I don't have with Ant is that there
are no 'shorthand' options in mvn ie:

to declare a single dependency:
dependencies
  dependency/dependency
/dependencies

but as I only have 1 I should be able to write
dependency/dependency

This lack of a 'shorthand' form (for want of a better term), means
that a pom file grows to be much larger than necessary (even when I
can use a parent pom and inherit from that).

Another example is the filtering - this is from a project I'm working on
resources
resource
directorysrc/main/resources/directory
filteringtrue/filtering
includes
include**/hibernate.cfg.xml/include
include**/*.properties/include
/includes
/resource
resource
directorysrc/main/resources/directory
filteringfalse/filtering
includes
include**/*/include
/includes
/resource
resource
directorysrc/test/resources/directory
filteringtrue/filtering
includes
include**/hibernate.cfg.xml/include
/includes
/resource
resource
directorysrc/test/resources/directory
filteringfalse/filtering
includes
include**/*/include
/includes
/resource
resource
directorysrc/main/webapp/directory
filteringtrue/filtering
includes
include**/context.xml/include
/includes
/resource
resource
directorysrc/main/webapp/directory
filteringfalse/filtering
includes
include**/*/include
/includes
/resource
/resources

Because we have binary resources (image files) I have to explicitly
exclude those from the filtering when I just want to filter 4 files -
that's a lot of XML to filter 4 files

I guess that this requirement comes from the plexus container, but
it's a tangible annoyance that would help to reduce pom complexity if
there was a way of fixing it - and yes I know you can use an IDE to
simplify/auto-complete writing your pom, but that's irrelevant - I
shouldn't have to use an IDE to edit my build/make/pom file - tools
are there to make your life easier, they shouldn't be a requirement.

Enough moaning, I'll checkout the mvn srcs and start writing javadoc
patches etc, maybe I can fix my pet peeves :p

Kev

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



Re: filter plugin?

2007-09-25 Thread Kevin Jackson
Hi,

 Is there a plain filter plugin we can use just to do replacements for
 the templated code at a phase we designate earlier in the lifecycle?

We use the ant-run plugin at the gen-sources phase to filter resources
before the package phase (when the war plugin executes)

Kev

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



Re: Why Maven is Hard?

2007-09-25 Thread Kevin Jackson
Hi,

I've been reading this thread with interest.

 No it's not a catch 22.  I will clarify what I was saying in my other
 statement.  People have exactly 2 choices when faced with a problem such as
 documentation.  The first one is to say, Boy this product is too hard for
 me to learn and there isn't enough documentation, so I'll go find something
 else.  The second option is to say, Boy this product is hard, but I really
 think it could help me on my product so I will learn how to use it and ask
 questions on the list.  Then, because I had so much trouble starting, I will
 recontribute back what I learned to the project.  No one is forcing anyone
 to do anything.  That's the beauty and bane of free software.  In order for
 it to be free, someone has to invest THEIR time to provide you the free
 software.  If you don't like it, you can move on without losing a monetary
 investment.  The bane is that because the contributers/developers aren't
 usually getting paid, they have to have other jobs where they make their
 living.  To demand that they make sure you get the documentation that you
 want rather than keep up with regular features for others that don't need
 the documentation isn't fair either.  Others like me have been fine without
 the documentation, so the question is more why have some succeeded and
 others failed?

In my opinion, those that have succeeded with mvn have been 1 of 2 types:

1 - using mvn for simple tasks
2 - mvn developers

I currently have a project I'm working on which has a multi-stage
build and requires several 3rd-party mvn plugins.  Getting this to
work correctly has been a nightmare - there's no other way of
describing the frustration with the lack of documentation of the core
of mvn.

Now we also had some specialised requirements (as is often the case),
so I've had to write and maintain 4 custom plugins for our build.  So
from last November (mvn newbie) to now I've done a considerable amount
of mvn hacking, including supplying patches for plugins and writing
new plugins.

mvn internally has appalling docs, there's practically no javadoc in
the project - this makes writing patches to mvn itself tedious and
frustrating - and *I want to get involved*.  For someone who isn't
interested in getting involved, but they need to fix a bug in mvn (and
yes mvn has bugs), they open the sources and see undocumented code -
that's a massive turn off.

Perhaps I'm in the minority, but the mvn mailing lists (users/dev) are
not the source of answers I thought they would be - I've asked a few
questions on how to configure a plugin/build to achieve the output I
wanted - and no there wasn't a reply with an answer.

Here is an example:

The mvn-war-plugin (which combined with the jspc-plugin should allow
me to only create a war with .class files (no jsps included)).  By
default, this plugin includes everything, so setting warSourceExcludes
to exclude the jsp files is the solution - except it isn't.  If you
set warSourceExcludes to exclude the unnecessary jsp files, it still
includes the empty dirs that the jsps were in - this makes my war
larger than it should be.

If I manually specify exactly what to include I get a massive
warSourceIncludes section (which must be repeated in each profile as
mvn  plexus don't support xml entity fragments eg warSources;)

I'd like to modify the mvn-war-plugin source to exclude empty dirs,
but again the code isn't well documented and I'd have to maintain a
custom version of this plugin instead of using the normal one
available on ibiblio/maven2 (I already maintain a custom jspc plugin
as it's being re-written in groovy at the moment and is dependent on a
broken version of ant which has a URI bug)

 It's a big short sighted to even assume that someone would say, Go pour
 through the source and write documentation.  That's also quite a bit overly
 dramatic.  If I had to pour through source in order to learn how to use
 Maven, I would have sucked it up and moved on.

Welcome to my world - to get anything done (writing mvn plugins,
fixing bugs in plugins we use etc), this is exactly what I have to do
- and no it isn't overly dramatic, I have to read the src for various
plugins and mvn just to work out what is happening as there are no API
docs.  Often the plugin svn repo has changed location and the site
hasn't been updated, so then you have to hunt down the correct svn
location using trial and error - again this is a doc issue (jspc
plugin had exactly this problem)

 Once again I reiterate, if
 you take it step by step then you will be fine.  Ant is NOT any easier to
 create a build system with.

In my experience Ant is much more easy to make a build system, but to
each his own

 For non multiproject builds, there is no reason
 that someone shouldn't be able to read the getting started and have a webapp
 up in a few minutes.

The problem is that people use mvn to begin with, with a simple
project and think 'wow it's so easy', then when used in more complex

XML entities or alternative?

2007-09-10 Thread Kevin Jackson
Hi,

I have a pom with two custom plugin configurations, both of which
require access to virtually identical configuration xml.  I'd like
to be able to declare the common xml in some way

I've tried using xml entities

!DOCTYPE project [
  !ENTITY config config goes here...
]

config;

But this fails with a XppPullparserException

I've also tried using a property to hold the escaped xml, but this
fails as the escaped version isn't parsed correctly

Is there any mechanism in mvn2 to allow the re-use of arbitrary xml
snippets within the same pom (and no I cannot put common stuff in a
parent pom, this isn't an option right now)

Thanks,
Kev

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



Access command line args in a unit test

2007-04-06 Thread Kevin Jackson

Hi all,

I have a utility class that is tested via a Test class via surefire/junit4.

I want to test if the parameter -o has been passed as a command to
the maven command line.

Prior versions of mvn allowed me to access the args via :
System.getenv(MAVEN_COMMAND_LINE_ARGS) (on windows) or
System.getenv(QUOTED_ARGS) on linux (why do the launch scripts for
the two platforms use different variable names?)

The problem now is that since the release of 2.0.6, the QUOTED_ARGS
value is no longer being exported in the mvn shell script.

As this wasn't mentioned in the release notes for mvn2.0.6, I have now
to build a workaround so that should the maven team decide to randomly
change the shell scripts and batch files, I have a more robust
solution in place that won't break.

Is there any other way of getting access to the command line args from
a class without going through the System.getenv - so far I've found no
way of accessing the -o value that I pass in on mvn2.0.6.

Any hints/advice welcome.

Thanks,
Kev

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



Re: ant scp task in maven2

2007-03-15 Thread Kevin Jackson

Hi,


I need some help. I tried to include the Ant task scp in my Maven2 pom.xml
by defining taskdef name=scp classname=com.jcraft.jsch.JSch / using
the maven-antrun-plugin. But it doesn't work Embedded error: No public
execute() in class com.jcraft.jsch.JSch. If you want to start this task in
ant you simple have to copy the jsch-version.jar in your local ant/lib
directory and the scp task becomes available. What have I to do to get it
work in Maven2. I need this task to secure copy files from a local machine
to a remote linux machine.



I did this like so:
plugin
groupIdorg.apache.maven.plugins/groupId
artifactIdmaven-antrun-plugin/artifactId
executions
execution
goals
goalrun/goal
/goals
/execution
/executions
configuration
tasks
!-- read in build.xml --
ant antFile=build.xml target=/
/tasks
/configuration
/plugin

Then for the jsch stuff I used maven to manage it (downloading etc)
and then in the ant file I used an ant target to get the ant-jsch.jar
file and then used taskdef to define it - note that Ant hates having
a copy of the jar in your classpath and a copy in ANT_HOME/lib:

target name=init
!-- Sanity check for delegating classloader problems --   
  
available property=ant-jsch.present 
file=${ant.home}/lib/ant-jsch.jar/
fail if=ant-jsch.present message=Please remove ant-jsch.jar
from ANT_HOME/lib see [
http://ant.apache.org/faq.html#delegating-classloader ]/

path id=jsch.path
pathelement location=${src.tools.dir}/jsch/ant-jsch.jar 
/
pathelement 
location=${src.tools.dir}/jsch/jsch-0.1.24.jar /
/path

taskdef name=scp

classname=org.apache.tools.ant.taskdefs.optional.ssh.Scp
classpathref=jsch.path /

taskdef name=sshexec

classname=org.apache.tools.ant.taskdefs.optional.ssh.SSHExec
classpathref=jsch.path /

macrodef name=ssh-cmd
attribute name=command/
attribute name=fail default=true/
sequential
sshexec 
host=${deploy.machine.address}
port=${deploy.machine.ssh.port}
username=root 
password=${deploy.machine.root.user.password}

command=@{command}
failonerror=@{fail} 
trust=true/
/sequential
/macrodef
/target

Getting the repo is easy enough through ant ${user.home}/.m2/repository/...

And in your pom.xml you declare the dependency on ant and antjsch

Kev

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



${project.profiles}

2007-02-19 Thread Kevin Jackson

Hi ,

I want to get access to the value of the activeProfile

For example :

mvn -P dev clean package

in my pom.xml I want to pass 'dev' to antrun without specifying it
twice (ie as a -D property on the command line)

I can get access to a List/Array of Profile with ${project.profiles}

plugin
groupIdorg.apache.maven.plugins/groupId
artifactIdmaven-antrun-plugin/artifactId
configuration
tasks
property name=mvn.repo value=${user.home}/.m2/repository/
ant antFile=build.xml target=${project.profiles}/
/tasks
/configuration
/plugin

but I want to be able to do either:

${project.profiles[0].id}

or

${project.activeProfile}

so that I can get the value of the currently running profile

Thanks
Kev

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



Re: Any plugin available to compile C# code?

2007-01-29 Thread Kevin Jackson

Hi,


Is there any dot net plugin available ?


You may be able to use the antrun plugin to compile C# code via the .net antlib

Kev

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



Re: Maven Ant Task problem when used with Ant 1.7.0

2007-01-09 Thread Kevin Jackson

Hi,


!-- But the following task throws a NullPointerException --
pathconvert property=echo.dependency.files
refid=dependency.files/


Are the maven ant task supposed to work with the last Ant 1.7.0 version ?
Any idea about what causes this problem ?


Ant 1.7 introduced the concept of ResourceCollections, this code would
have affected filesets, but I cannot diagnose the problem further
without a full stack trace from you NullPointerException.

Would you post this to the ant dev list : dev@ant.apache.org

Thanks
Kev

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



Shortening command lines with profiles?

2006-11-22 Thread Kevin Jackson

Hi all,

I currently have a mvn command line which is fairly long eg:

mvn clean compile war:inplace tomcat:inplace

Is it possible to use a profile to reduce this to something like:

mvn -P local-deploy

where I can specify the exact goals in the profile instead of on the
command line?

Thanks,
Kev

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



Re: tomcat deployer

2006-11-15 Thread Kevin Jackson

Hi,


This gets discussed fairly regularly and there's multiple ways to handle
it.
If you're not aware, there's a great search engine for this list at
http://www.nabble.com/Maven---Users-f178.html


I actually find Nabble to be close to useless as it doesn't seem to
get spidered by google properly, certainly MARC is my preferred place
to find stuff out - shame maven list isn't there :(



The way I've setup things I can see the changed jsp without calling
any maven target. There's more details of my solution here
http://www.nabble.com/Eclipse-war-builder-tf2371898s177.html#a6646490
Another fellow wrote a custom eclipse plugin to help him.


Could you go into more details?  I've followed what I could from your
post ^^ but I still cannot get Tomcat to deploy just the context.xml
file and use the target directory as an exploded webapp.  My guess is
that I've setup tomcat incorrectly, but a working example of what to
do would be great (I also tried the eclipse war builder thing and
again it didn't work for me).

Thanks
Kev

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



tomcat deployer

2006-11-14 Thread Kevin Jackson

Hi all,

I'm trying to work on a webapp with tomcat and mvn.  I want to be able
to edit a jsp, type mvn tomcat:redeploy and have just the changed jsp
be reloaded, without having to compile/package/deploy

I'm fairly sure that this is possible using a combination of mvn +
tomcat-plugin, but I'm failing the correct incantation test

so far I can do a mvn tomcat:deploy, but this
compiles/filters/packages and takes forever - not good for rapid
development of ui stuff

mvn tomcat:redeploy seems to just redeploy the application that's
already deployed in the CATALINA_HOME/webapps directory, what I need
is some way to configure the plugin to deploy my development directory
as an exploded web application

Thanks in advance for any/all help

Kev

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



Re: Overview - Ant to Maven

2006-11-01 Thread Kevin Jackson

for deploying have a look at cargo at:
http://cargo.codehaus.org/


I have used the cargo plugin and the tomcat plugin and both of them
have a flaw if you are deploying to a remote server (ie one without
maven installed on it).

When they deploy, they first undeploy your application, then they copy
the war file over from your client to the server, then they deploy the
new war file (just copied over).

This is ok if you have a fast connection between the client machine
(running maven) and the server (running tomcat).  But if you are doing
this over the internet, the time you application is offline can be
quite long as you must wait for the whole war file to be copied over
while your app isn't available.

Kev

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



M2 Cargo plugin now found...

2006-10-31 Thread Kevin Jackson

Hi all,

The problem I just spent 2 hours banging my head against was related
to where I declared the cargo-maven2-plugin

Declare the plugin under plugins and it downloads fine, declare it
under reportingplugins and you get *NO* information about why it
won't download

I'd like to suggest to any mvn2 devs lurking that some kind of
error/info message be displayed if the result of a build is failure
and the reason is that a plugin couldn't be found.

Perhaps:
Failure [Build Error]
xxx-plugin could not be found : Have you checked to ensure that you
have declared it under plugins not reportingplugins ?

A simple message like this would have saved me two hours

Thanks,
Kev

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



M2 Cargo plugin not found/working

2006-10-30 Thread Kevin Jackson

Hi all,

Very frustrated with maven2:
http://cargo.codehaus.org/Maven2+Plugin+Installation

Followed the instructions here, and set my pom to use the snapshot
repository suggested in the docs

result - maven-cago-plugin not found



[INFO] Searching repository for plugin with prefix: 'cargo'.
[INFO] 
[ERROR] BUILD ERROR
[INFO] 
[INFO] The plugin 'org.apache.maven.plugins:maven-cargo-plugin' does not exist o
r no valid version could be found


Great except I didn't want that I wanted cargo-maven2-plugin - so
change pom to use the ibiblio release (0.2, not 0.3-SNAPSHOT)

Still not found

Delete entry from ~.m2/org/apache/maven/plugins/

Still not found

Download and do a manual install of the plugin jar

Still not found

---

So I've spent an hour getting nowhere when I can plainly download the
damn jar, but m2 can't.

Questions I began to ask myself:

1 - Can anyone get this to work - is it just me
2 - If this is 'supposed' to work, why can't maven find a jar +
pom.xml at the specified uri
3 - Should I just re-write this using ant - after all that works
4 - Why are there no documents or other messages when you google for
this (or yahoo or anything)

Pom.xml section included in case anyone can see a problem:

plugin
groupIdorg.codehaus.cargo/groupId
artifactIdcargo-maven2-plugin/artifactId
!-- version0.3-SNAPSHOT/version--
version0.2/version
...

pluginRepository
idcodehaus-plugins-snapshots/id
urlhttp://snapshots.maven.codehaus.org/maven2/url
snapshots
enabledtrue/enabled
/snapshots
releases
enabledfalse/enabled
/releases
/pluginRepository

Thanks,
Kev

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