Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 211 Next »

NOTE: This page contains drafts of user contributed FAQ entries. The content you see here might not be fully fool-proof or might not comply with the best practices promoted by Maven. What is only guaranteed is that they have worked once for some members. It is best to treat these items as "works in progress" until they have been reviewed and promoted to the main Maven documentation site.

This is a place where users can list questions here that they would like answered. Please put new unanswered frequently asked questions at the bottom.

Please follow the format that is being used because it will help in our automated extraction of material which can then be incorporated into the main site.

Answered Questions (Index)

Previously answered questions can be found here.

Unanswered Questions

How do you copy a file from one directory to another just before a war is constructed?

The war plugin can be configured with additional resources as described in Adding and Filtering External Web Resources. The resource element is the same one that can be declared within the <build> section of your pom.xml file.

How do I have maven run my project... once again not a clue... ( or just spit out a commandline that I can pipe to a .bat file)

How about making sure all files needed are available so I can run disconnected?

How about being able to answer the question... why is this jar in my build?

How do I exclude a jar from my build no matter what dependency asks for it?

    Why could you want to do this? As far as I know, dependencies don't ask for things they don't need, so unless that's not correct, you're asking for a way to try to build the project without all the pieces it needs, which should fail.
 

When is the 2.1 version of Maven planned to be released?   (or alternatively is the fix for MNG-553 planned for a 2.0.X release?) This is critical for the corporation I work for.

How to replace "attainGoal" in maven 1 with plugin in maven 2?

I would like to write up a plugin that have multiple goals. Does anyone have some samples that can share? Basically, a sample goal that compiles the source and another one that packages it as a WAR would be sufficient. Please help and thanks in advance

The way to 'call goals' in maven 2 is using plugin. I think what you should do is write a plugin that comprises of other plugins (goals) that you wish to call with their respective phase. So when you call this plugin (say during compile phase), it in turn will call your 'configured plugins' to do their work. This has the same effect of specifying multiple goals.

I believe one can do the same thing without writing a plugin for it but if your requirements demand it, yes you can do it that way. For example I wrote a maven 2 plugin (boiler plate code generator) that uses jaxme plugin with some additional processing. I did sort of the same thing. This 'MyPlugin' used jaxme plugin & did some more operation as part of it's 'phase'.

 Why TaglibPlugin don't add inherited attributes to my TLD ?

 I'm using org.xdoclet.plugin.web.TaglibPlugin to generate TLD from my Tag library but inherited attributes are not generated. What should I do ?

XDoclet can only scan source files, so the parent class' source should be available to the plugin. Assuming
the parent class is in a different module, add a dependency for the source artifact to the plugin definition in the build section.


Where can I find a listing of the available variable references that could be use during site generation?

How do I run a shell script from inside a Mojo?

See http://mojo.codehaus.org/exec-maven-plugin/exec-mojo.html

Will the release plug-in resolve all my SNAPSHOT dependencies?

No, it will check if there are still any SNAPSHOT dependencies there and won't proceed if there are. You
will have to manually choose a stable (released) version before you can release.

How to copy files from local repo to remote repository?

You should use deploy plugin. This plugin will also create SHA1 & MD5 files needed for checksum. 

Where should sql, dtds, test data and generated docs go?

SQL typically goes in src/main/sql, and I don't see a reason why DTDs couldn't follow the same pattern-src/main/dtd-but I'm not sure that DTDs would need to be included in the build in all cases. Depends on what you want to do with them.

Test data would logically go in something like src/test/resources or some such, but I would imagine it doesn't matter as long as you explicitly draw it in with a <resource> tag in your pom.xml file. See  the POM reference and Ctrl-F for "resource."

Is there a way for plugin goals to be aware of the phase they are being executed on?

On a related note, is there at least a way to indicate in Maven's output when a particular phase begins, so that one can deduce a plug-in's execution phase?

 When you have a project using a code generator plugin, how can we add the generated sources in the list of eclipse source directory?

How do I tell maven which version of ant I want it to call?

How do I display special characters (i.e. copyright symbol, latin-1) with APT?


Is it possible to read a file (in standard property=value format) specified in the POM and have those properties available for substitution in ${} tokens? 



This is already covered in the APT mini-guide. http://maven.apache.org/guides/mini/guide-apt-format.html


 I have an issue with my user.home directoy have either a space or special character ie. C:\Documents and Settings\myname & someothername. This causes an org.codehaus.plexus.util.xml.pull.XmlPullParserException: entity reference names can not start with character ' ' (position: START_TAG seen ...<extendC:\Documents and Settings\myname & ... @2:44) error. Does anyone have an idea how to fix this without creating a new Windows account <read major pain> Thanks

Use the Windows short filenames for "Documents and Settings" and any other parts of the path that contain spaces.

 To find the "short filename" open a DOS box and go to the containing folder. In this example, the root of drive C: and type "DIR /X" (If you forget, type DIR /? and notice the X option gives you the "short" name. My computer shows this:

06/09/2006  10:21 AM    <DIR>          DOCUME~1     Documents and Settings 

The "short" name is DOCUME~1 and the full name is shown to it's right.

Now ... someone needs to fill in the part about how to get user.home set to the location using "short" names. 

 How do I call another Mojo (in a different plugin) from my Mojo?


How do I get a list of all available properties?

How do I get a list of all available properties? I already found a static list (*http://docs.codehaus.org/display/MAVENUSER/MavenPropertiesGuide), *but there should be a way to create a list of all available properties and their values during the build , e.g. by using a Properties-Plugin.

 Here is some more helpful information from the user list:

There is no official list of [Maven 2] properties.

One thing that helps is that things defined in the POM can sometimes be referenced as properties. For example project.build.finalName gives the value from the pom that is defined in: <project>
<build>
<finalName>xyz</finalname>
</build>
</project>
(Skipping all the other parts of the POM) Just put the tags from the top down with "dot"s between.

There is a tricky part to this though. The POM you are looking at may have a parent pom from which it inherits values and all POMs have an ultimate ancestor in the "SUPER" pom.

If you give the command "mvn help:effective-pom" it will show you the full resulting POM that results when all the inheritance and such are considered. You can look at this pom to find the "dot" format that is used to reference something in particular. Do this by looking at how the XML tags are nested to get to a particular value.

How can I get jetty to run just before the test phase so that I can test my webapps with just "mvn test"?

Specific [Unanswered] Errors - Need more information

I've got my plugin pom setup to build everything and construct the final zip file. The issue I'm trying to wrap my brain around is keeping my feature.xml and site.xml files up to date with the correct version info. Since I can't use versions like 1.0.0-SNAPSHOT in my plugin, I have to munge the plugins pom version into something like 1.0.0.v${DATETIME} and insert that into the plugins descriptor (plugin.xml). Since the version in the plugin.xml changes I have to update the plugin entries in the feature descriptor (feature.xml), rev the feature and update the site.xml with the new feature version. Just curious to see if anyone else out there is struggling with these same issues and what if any solutions/band-aids have been implemented


jdcasey

This is more of a user-list type of question. It's going to be an in-depth discussion about designing and/or configuring a suite of plugins for a very specific purpose. This probably isn't a Frequently Asked Question.


Why the FTP Wagon hangs?


jdcasey

Need more information on this. Under what circumstances does this happen? Can the user access the server in another FTP client? Is there a stack trace associated? Do they have a corresponding <server/> section in the settings.xml?


When I run the release:prepare goal I get an authorization failed error. I tried adding the username and password into my pom.xml file and I still get the error. I checked using the command line and my username and password is being cached by subversion. Any ideas?

Your username and password may be cached separately by short and long (hostname+domain) remote repository hostnames. That is, if you access the subversion repository on the command line as "http://svn/..." and maven is using "http://svn.dev.busy.com/..." (or vice versa) your password may not be cached for both.

Suppose you have a database library in project A on svn.dev.busy.com, try the following two commands:

and

If either of these requires a password, then your password to SVN was not cached like it should have been, but now it should be cached, and the mvn release:prepare should succeed.

You may prefer to use the Maven SCM Plugin to diagnose this problem, like this:


jdcasey

This is the entry point for a debugging discussion. From here, the user may need to verify that they have the 'svn' command in their path, and that Maven is trying to use subversion with the same username that the user has verified by hand. After that, it depends.


dfabulich

LEOPARD USERS: Beware that "svn --non-interactive commit" is broken on Mac OS X 10.5 leopard. http://subversion.tigris.org/issues/show_bug.cgi?id=3059 http://jira.codehaus.org/browse/MRELEASE-355







Why am I getting this error when I build my project: "Unable to locate the Javac Compiler"?


jdcasey

We would need to get more information about this user's POM and environment (output of the build would be most valuable) in order to effectively answer this question. Without this context, it is unanswerable.


Why do I get java.lang.NullPointerException while trying to generate site for a project?


jdcasey

Even a simple stacktrace for this user's error would help immensely in debugging this problem. Without specifics, any higher analysis is virtually impossible.

kenney

Probable cause: no <url> in the pom. The NPE is fixed long ago.






How to make archetype where project artifacts have names based on artifactId?

*How can I create an archetype where one of the archetype-resource files should be created with a name based on the artifactId? For instance, if I ask to create a new project based on my archetype with -DartifactId=foobar, then I'd like a foobar-stuff.xml file to appear in the project. I know that I can use ${artifactId} within files, but how can I do the same thing with filename?
 *

How can I add two different source-directories to a project?

The build-helper-maven-plugin can help you out.

Compilation of dependencies in a project

Is there any solution that could be used to compile my dependencies (building the jars to bring it up-to-date) when I generate my webapplication?
Arnault

On the "Maven in 5 Minutes" page, when I gave the command "mvn package", it didn't work.


LordGro

The text neglected to say that, just before you give the command "mvn package", you have to give the
command "cd my-app" .

How do I always invoke a plugin goal from install goal?

When using the maven-buildnumber-plugin I want to always have the "buildNumber" value I use in the finalName. This requires me to invoke mvn buildnumber:create install for my project. How do I configure my pom.xml to just invoke mvn install and automatically invoke the buildnumber:create goal?

How do I use buildnumber plugin "buildNumber" value with ANT?

Using mvn ant:ant I can generate an ANT build XML. However, the finalName utilized from the pom.xml has reference to the "buildNumber" I use from the buildnumber plugin. This value is not passed to ANT. What suggestions do people have to use the SVN revision number in the ANT script. Note: the ANT script is generated. Any changes are overritten.


How can I use configuration files of a dependent module in tests of the current module?

i.e. if module X depends on module Y and module Y has some configuration files, tests of module X will might want to see those files.

How do I reuse the plugin configuration without using inheritance?

  • No labels