[Maven 2] plugin using project ressources

2010-07-19 Thread anis chaaba
Hello everybody,
What can I do to make my plugin use ressources of the project running into
it ?
My test projects are attached to this mail.
When executing the goal of my plugin i get
 java.util.MissingResourceException: Can't find bundle for base name
localisations, locale fr_FR
 at
java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1521)
at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1260)
 at java.util.ResourceBundle.getBundle(ResourceBundle.java:715)
at bundle.plugin.MyMojo.execute(MyMojo.java:69)
 at
org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
 at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:569)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:539)
 at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
 at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
 at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
 at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
 at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
 at org.codehaus.classworlds.Launcher.main(Launcher.java:375).
Thanks in advance.

-
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Re: [Maven 2] plugin using project ressources

2010-07-19 Thread anis chaaba
No body faced the same problem ?
I found this thread which talking about the same problem but no clear
solution was given.
http://www.mail-archive.com/users@maven.apache.org/msg59165.html
Please Help :S

On Mon, Jul 19, 2010 at 11:42 AM, anis chaaba  wrote:

> Hello everybody,
> What can I do to make my plugin use ressources of the project running into
> it ?
> My test projects are attached to this mail.
> When executing the goal of my plugin i get
>  java.util.MissingResourceException: Can't find bundle for base name
> localisations, locale fr_FR
>  at
> java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1521)
> at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1260)
>  at java.util.ResourceBundle.getBundle(ResourceBundle.java:715)
> at bundle.plugin.MyMojo.execute(MyMojo.java:69)
>  at
> org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
> at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
>  at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:569)
> at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:539)
>  at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
> at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
>  at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
> at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
>  at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
> at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
>  at
> org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>  at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>  at java.lang.reflect.Method.invoke(Method.java:597)
> at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
>  at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
> at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
>  at org.codehaus.classworlds.Launcher.main(Launcher.java:375).
> Thanks in advance.
>


Re: [Maven 2] plugin using project ressources

2010-07-20 Thread anis chaaba
And now ?

On Mon, Jul 19, 2010 at 10:16 PM, Anders Hammar  wrote:

> No projects were attached...
>
> /Anders
>
> On Mon, Jul 19, 2010 at 11:42, anis chaaba  wrote:
>
> > Hello everybody,
> > What can I do to make my plugin use ressources of the project running
> into
> > it ?
> > My test projects are attached to this mail.
> > When executing the goal of my plugin i get
> >  java.util.MissingResourceException: Can't find bundle for base name
> > localisations, locale fr_FR
> >  at
> >
> java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1521)
> > at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1260)
> >  at java.util.ResourceBundle.getBundle(ResourceBundle.java:715)
> > at bundle.plugin.MyMojo.execute(MyMojo.java:69)
> >  at
> >
> org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
> > at
> >
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
> >  at
> >
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:569)
> > at
> >
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:539)
> >  at
> >
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
> > at
> >
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
> >  at
> >
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
> > at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
> >  at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
> > at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
> >  at
> > org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >  at
> >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> > at
> >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> >  at java.lang.reflect.Method.invoke(Method.java:597)
> > at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
> >  at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
> > at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
> >  at org.codehaus.classworlds.Launcher.main(Launcher.java:375).
> > Thanks in advance.
> >
> >
> > -
> > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> > For additional commands, e-mail: users-h...@maven.apache.org
> >
>

-
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Re: [Maven 2] plugin using project ressources

2010-07-20 Thread anis chaaba
ry*
*{*
*File f = new File(element);*
*URL newURL = f.toURI().toURL();*
*classpathURLs.add(newURL);*
*getLog().debug("Added to classpath " + element);*
*}*
*catch (Exception e)*
*{*
*throw new MojoExecutionException("Error parsing
classpath " + additionalClasspath + " "*
* + e.getMessage());*
*}*
*}*
*}*
*
*
*URL[] urls = (URL[]) classpathURLs.toArray(new
URL[classpathURLs.size()]);*
*return new URLClassLoader(urls, classLoader);*
*}*
*}*


and the pom of my artifact

**
* **bundle.plugin*
* **test-bundle-plugin*
* **1.0-SNAPSHOT*
* ***
* **${project.build.sourceDirectory}*
* **
${project.compileClasspathElements}*
* ***
* ***
* ***
*
*
* **compile*
* ***
* **exec*
* ***
* **false*
* ***
* **src/main/java*
* **
${project.compileClasspathElements}*
* ***
* ***
* ***
* **.*
*
*
Thanks in advance :)

On Tue, Jul 20, 2010 at 10:19 AM, anis chaaba  wrote:

> And now ?
>
>
> On Mon, Jul 19, 2010 at 10:16 PM, Anders Hammar  wrote:
>
>> No projects were attached...
>>
>> /Anders
>>
>> On Mon, Jul 19, 2010 at 11:42, anis chaaba  wrote:
>>
>> > Hello everybody,
>> > What can I do to make my plugin use ressources of the project running
>> into
>> > it ?
>> > My test projects are attached to this mail.
>> > When executing the goal of my plugin i get
>> >  java.util.MissingResourceException: Can't find bundle for base name
>> > localisations, locale fr_FR
>> >  at
>> >
>> java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1521)
>> > at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1260)
>> >  at java.util.ResourceBundle.getBundle(ResourceBundle.java:715)
>> > at bundle.plugin.MyMojo.execute(MyMojo.java:69)
>> >  at
>> >
>> org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
>> > at
>> >
>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
>> >  at
>> >
>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:569)
>> > at
>> >
>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:539)
>> >  at
>> >
>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
>> > at
>> >
>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
>> >  at
>> >
>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
>> > at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
>> >  at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
>> > at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
>> >  at
>> > org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
>> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> >  at
>> >
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>> > at
>> >
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>> >  at java.lang.reflect.Method.invoke(Method.java:597)
>> > at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
>> >  at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
>> > at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
>> >  at org.codehaus.classworlds.Launcher.main(Launcher.java:375).
>> > Thanks in advance.
>> >
>> >
>> > -
>> > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
>> > For additional commands, e-mail: users-h...@maven.apache.org
>> >
>>
>
>


Re: [Maven 2] plugin using project ressources

2010-07-21 Thread anis chaaba
So, no answers ? no solutions ? nobdoy tried to do the same thing ? :(

On Tue, Jul 20, 2010 at 10:27 AM, anis chaaba  wrote:

> *Attachement does not work so here are my sources.*
> *
> *
> *package bundle.plugin;*
> *
> *
> */**
> * * Copyright 2001-2005 The Apache Software Foundation.*
> * **
> * * Licensed under the Apache License, Version 2.0 (the "License");*
> * * you may not use this file except in compliance with the License.*
> * * You may obtain a copy of the License at*
> * **
> * *  http://www.apache.org/licenses/LICENSE-2.0*
> * **
> * * Unless required by applicable law or agreed to in writing, software*
> * * distributed under the License is distributed on an "AS IS" BASIS,*
> * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> implied.*
> * * See the License for the specific language governing permissions and*
> * * limitations under the License.*
> * */*
> *
> *
> *import java.io.File;*
> *import java.lang.reflect.Method;*
> *import java.net.URL;*
>  *import java.net.URLClassLoader;*
> *import java.util.ArrayList;*
> *import java.util.List;*
> *import java.util.ResourceBundle;*
> *
> *
> *import org.apache.maven.plugin.AbstractMojo;*
> *import org.apache.maven.plugin.MojoExecutionException;*
> *import org.apache.maven.project.MavenProject;*
> *
> *
> */***
> * * Goal which touches a timestamp file.*
> * * *
> * * @goal exec*
> * * *
> * * @phase process-sources*
> * * *
> * * @requiresProject true*
> * */*
> *public class MyMojo extends AbstractMojo*
> *{*
> */***
> * * @parameter expression="${project}*
> * */*
> *private MavenProject project;*
> *
> *
> */***
> * * Maven Internal: List of artifacts for the plugin.*
> * * *
> * * @parameter expression="${plugin.artifacts}"*
> * * @requiresDependencyResolution compile*
> * * @required*
> * * @readonly*
> * */*
> *protected List pluginClasspathList;*
> **
> */***
> * * This is where the generated java sources are stored.*
> * * *
> * * @parameter
> expression="${project.build.directory}/jasperreports/java"*
> * */*
> *private File javaDirectory;*
> **
> */***
> * * Any additional classpath entry you might want to add to the
> JasperReports compiler. Not recommended for general*
> * * use, plugin dependencies should be used instead.*
> * * *
> * * @parameter*
> * */*
> *private String additionalClasspath;*
> *
> *
> */***
> * * @parameter expression="${project.compileClasspathElements}"*
> * */*
> *private List classpathElements;*
> *
> *
> *public void execute() throws MojoExecutionException*
> *{*
> *
> *
> *StringBuilder classpath = new
> StringBuilder(System.getProperty("java.class.path", ""));*
> *classpath.append("${plugin.artifacts}");*
> *System.setProperty("java.class.path", classpath.toString());*
> *getLog().info("*");*
> *getLog().info(System.getProperty("java.class.path"));*
> *ClassLoader classLoader =
> getClassLoader(ClassLoader.getSystemClassLoader());*
> *Thread.currentThread().setContextClassLoader(classLoader);*
> **
> *getLog().info("project " + javaDirectory);*
> *project.addCompileSourceRoot(javaDirectory.getAbsolutePath());*
> *try*
> *{*
> *Class ress =
> classLoader.loadClass(ResourceBundle.class.getName());*
> *   // getMethod( "run", List.class,*
> *Method getB = ress.getMethod("getBundle", new Class[]
> {String.class});*
> *ResourceBundle bundle = (ResourceBundle) getB.invoke(null,
> new Object[] {"localisations"});*
> *getLog().info(bundle.getString("appli.web.root"));*
> *}*
> **
> *catch (Exception e)*
> *{*
> *e.printStackTrace();*
> *}*
> *   *
> *   // ResourceBundle bundle =
> ResourceBundle.getBundle("localisations");*
> *   *
> *}*
> **
> *private ClassLoader getClassLoader(ClassLoader classLoader) throws
> MojoExecutionException*
> *{*
> *List classpathURLs = new ArrayList();*
> *
> *
> *for (int i = 0; i < classpathElements.size(); i++)*
> *{*
> *String element = (String) classpathElements.get(i);*
> *try*
> *{*

Maven Classloading : Custom Classloaders

2010-07-23 Thread anis chaaba
Hello,
I'm developing a plugin which is supposed  to create a classloader that
combines the plugin class path and the project class path. Is there samples
for that ?

What i did is :

 public void execute() throws MojoExecutionException
{

ClassLoader classLoader = *getClassLoader*
(ClassLoader.getSystemClassLoader());
try
{
Class ress =
classLoader.loadClass(ResourceBundle.class.getName());
Method getB = ress.getMethod("getBundle", new Class[]
{String.class});
ResourceBundle bundle = (ResourceBundle) getB.invoke(null, new
Object[] {"localisations"});
getLog().info(bundle.getString("appli.web.root"));
}
catch (ClassNotFoundException e)
{...
  }

  private ClassLoader *getClassLoader*(ClassLoader classLoader) throws
MojoExecutionException
{
List classpathURLs = new ArrayList();

for (int i = 0; i < classpathElements.size(); i++)
{
String element = (String) classpathElements.get(i);
try
{
getLog().info("classpathElements " + element);
File f = new File(element);
URL newURL = f.toURI().toURL();
classpathURLs.add(newURL);
getLog().debug("Added to classpath " + element);
}
catch (Exception e)
{
throw new MojoExecutionException("Error parsing classparh "
+ element + " " + e.getMessage());
}
}

URL[] urls = (URL[]) classpathURLs.toArray(new
URL[classpathURLs.size()]);
return new URLClassLoader(urls, classLoader);
}


Logs are

*java.lang.reflect.InvocationTargetException*
* **at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)*
* **at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
*
* **at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
*
* **at java.lang.reflect.Method.invoke(Method.java:597)*
* **at bundle.plugin.MyMojo.execute(MyMojo.java:66)*
* **at
org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
*
* **at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
*
* **at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:569)
*
* **at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:539)
*
* **at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
*
* **at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
*
* **at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
*
* **at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)*
* **at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)*
* **at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)*
* **at
org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)*
* **at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)*
* **at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
*
* **at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
*
* **at java.lang.reflect.Method.invoke(Method.java:597)*
* **at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)*
* **at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)*
* **at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
*
* **at org.codehaus.classworlds.Launcher.main(Launcher.java:375)*
*Caused by: java.util.MissingResourceException: Can't find bundle for base
name localisations, locale fr_FR*
* **at
java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1521)
*
* **at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1260)*
* **at java.util.ResourceBundle.getBundle(ResourceBundle.java:715)*
* **... 24 more*


[Maven 2] [surefire] Success Details

2011-02-17 Thread anis chaaba
Hello people :)
Is there a way to have all traces embded in the generated site by
maven-surefire-report-plugin and maven-site-plugin ?
Thanks in advance.


make surefire show full stacktrace in plain reports

2011-03-09 Thread anis chaaba
Hello,
What can i do to make surefire show full stacktrace in console and plain txt
reports under surefire reports ?
when i use the option *redirectTestOutputToFile* I have the trace but not
the error stacktrace*.*
Help please :)

Here's my plugin configuration :


On Wed, Mar 9, 2011 at 5:16 PM, Wendy Smoak  wrote:

> On Wed, Mar 9, 2011 at 9:22 AM, Jochen Wiedmann
>  wrote:
> > No chance?
>
> I would probably package the site up as a zip and put it in the
> repository, then dependency:unpack it where you want it in the webapp.
>  That assumes the documentation is in a separate module.
>
> Otherwise, I'd probably just expect to run "mvn site install" in order
> to build it (not trying to bind an execution of the site plugin in the
> project pom, as you've noted it has side effects.)
>
> If that doesn't help, try posting a simple example project that
> demonstrates the problem so people can play with it.
>
> --
> Wendy
>
> -
> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> For additional commands, e-mail: users-h...@maven.apache.org
>
>


Re: configure Maven to dynamically select profiles

2011-07-13 Thread anis chaaba
Hi,
U can play with activation method using   tag.
this may be helpful
http://maven.apache.org/guides/introduction/introduction-to-profiles.html
good luck :)

On Wed, Jul 13, 2011 at 10:14 AM, Vivek  wrote:

> case I have single pom.xml an