Hi,
No, it's not possible AFAIK: Java doesn't have the notion of a 'current directory' or 'working directory'; you can only find out the directory that java started from, and it cannot be changed (like chdir(2) @ man-pages). (Btw, I'f I'm wrong I sure want to know about it! :)) All plugins however have access to a ${basedir} variable, containing the path to the pom.xml currently being built. If you look at MavenArcheTypePlugin line 179, you'll find: String basedir = System.getProperty( "user.dir" ); So this plugin only supports creating/updating projects in the startup directory. You might get away with updating that system property (but it's probably readonly), and even if it's possible to update it I can't recommend it, especially in a multithreaded environment like Eclipse (your plugin could be called from the embedder). Your best bet is to get the archetype plugin updated[1], or use the archetype api directly - the plugin is actually only a few lines of code. -- Kenney [1] : Index: src/main/java/org/apache/maven/plugin/archetype/MavenArchetypeMojo.java =================================================================== --- src/main/java/org/apache/maven/plugin/archetype/MavenArchetypeMojo.java (revision 452498) +++ src/main/java/org/apache/maven/plugin/archetype/MavenArchetypeMojo.java (working copy) @@ -155,6 +155,11 @@ */ private MavenProject project; + /** + * @param default-value="${user.dir}" + */ + private String basedir = System.getProperty( "user.dir" ); + public void execute() throws MojoExecutionException { @@ -176,8 +181,6 @@ groupId = project.getGroupId(); } - String basedir = System.getProperty( "user.dir" ); - if ( packageName == null ) { getLog().info( "Defaulting package to group ID: " + groupId ); kovalen pechaycaren wrote:
Hello, I have developed some maven2 plugins and to run them I should be in the directory of the pom.xml file. Is there a way of running my plugin anywhere (like for e.g mvn archetype:create)? Thanks
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]