Generated Sources

11 messages Options
Embed this post
Permalink
Alexander von Zitzewitz () Generated Sources
Reply Threaded More More options
Print post
Permalink
Some javascript/style in this post has been disabled (why?)
Generated Sources Hello !

Looks like target/generated-sources is ommited from Sonar Analysis. Is this by intention?

Best regards

Alexander von Zitzewitz



www.hello2morrow.com

SonarJ Elevator Pitch: http://www.hello2morrow.com/videos/benefits

+1 (877) 294-6327



Freddy Mallet () Re: Generated Sources
Reply Threaded More More options
Print post
Permalink
Hello Alexander,

Sorry for this late answer.

target/generated-sources can be analyzed by Sonar but in that case the Maven phase "generated-sources" must be first called. For this, you must tell Sonar to call this phase by adding the parameter "-Dsonar.phase=generate-sources" to the "mvn sonar:sonar" command.

regards,
Freddy


On Mon, Oct 12, 2009 at 11:41 PM, Alexander von Zitzewitz <[hidden email]> wrote:
Hello !

Looks like target/generated-sources is ommited from Sonar Analysis. Is this by intention?

Best regards

Alexander von Zitzewitz



www.hello2morrow.com

SonarJ Elevator Pitch: http://www.hello2morrow.com/videos/benefits

+1 (877) 294-6327




Alexander von Zitzewitz () Re: Generated Sources
Reply Threaded More More options
Print post
Permalink
Some javascript/style in this post has been disabled (why?)
Re: [sonar-dev] Generated Sources Hello Freddy !

I am not sure if I am really happy with that. Our SonarJ Maven Plugin runs in the verify phase, so it assumes, that code is generated. On the other hand I can understand, that nobody wants to analyze generated code with Checkstyle. Isn’t here a possibility that the Plugin Handler tells Sonar if he expects generated sources or not? Probably this requirement really depends on the plugin to be run.

Best regards


Alexander


On 10/14/09 5:08 PM, "Freddy Mallet" <freddy.mallet@...> wrote:

Hello Alexander,

Sorry for this late answer.

target/generated-sources can be analyzed by Sonar but in that case the Maven phase "generated-sources" must be first called. For this, you must tell Sonar to call this phase by adding the parameter "-Dsonar.phase=generate-sources" to the "mvn sonar:sonar" command.

regards,
Freddy


On Mon, Oct 12, 2009 at 11:41 PM, Alexander von Zitzewitz <a.zitzewitz@...> wrote:
Hello !

Looks like target/generated-sources is ommited from Sonar Analysis. Is this by intention?

Best regards

Alexander von Zitzewitz



www.hello2morrow.com <http://www.hello2morrow.com>

SonarJ Elevator Pitch: http://www.hello2morrow.com/videos/benefits

+1 (877) 294-6327





Alexander von Zitzewitz



www.hello2morrow.com

SonarJ Elevator Pitch: http://www.hello2morrow.com/videos/benefits

+1 (877) 294-6327




Freddy Mallet () Re: Generated Sources
Reply Threaded More More options
Print post
Permalink
Hello Alexander,

Perhaps my first explanation was not totally clear. I guess you've developed a Sonar plugin which configures and launches the SonarJ Maven Plugin. Even if this SonarJ Maven plugin is launched by Sonar, it has its own Maven lifecycle. So if your SonarJ Maven Plugin depends on the Maven verify phase, this phase should be automatically launched by Maven. There is in fact absolutely no difference between launching the SonarJ Maven Plugin by hand or through Sonar.

When you say that your SonarJ Maven Plugin runs in the verify phase, do you mean that you've added the annotation "@goal verirfy" to your SonarJ Mojo ?

http://maven.apache.org/guides/plugin/guide-java-plugin-development.html

Hope it helps,
Freddy


On Mon, Oct 19, 2009 at 6:17 PM, Alexander von Zitzewitz <[hidden email]> wrote:
Hello Freddy !

I am not sure if I am really happy with that. Our SonarJ Maven Plugin runs in the verify phase, so it assumes, that code is generated. On the other hand I can understand, that nobody wants to analyze generated code with Checkstyle. Isn’t here a possibility that the Plugin Handler tells Sonar if he expects generated sources or not? Probably this requirement really depends on the plugin to be run.

Best regards


Alexander



On 10/14/09 5:08 PM, "Freddy Mallet" <freddy.mallet@...> wrote:

Hello Alexander,

Sorry for this late answer.

target/generated-sources can be analyzed by Sonar but in that case the Maven phase "generated-sources" must be first called. For this, you must tell Sonar to call this phase by adding the parameter "-Dsonar.phase=generate-sources" to the "mvn sonar:sonar" command.

regards,
Freddy


On Mon, Oct 12, 2009 at 11:41 PM, Alexander von Zitzewitz <a.zitzewitz@...> wrote:
Hello !

Looks like target/generated-sources is ommited from Sonar Analysis. Is this by intention?

Best regards

Alexander von Zitzewitz



www.hello2morrow.com <http://www.hello2morrow.com>

SonarJ Elevator Pitch: http://www.hello2morrow.com/videos/benefits

+1 (877) 294-6327





Alexander von Zitzewitz



www.hello2morrow.com

SonarJ Elevator Pitch: http://www.hello2morrow.com/videos/benefits

+1 (877) 294-6327





Alexander von Zitzewitz () Re: Generated Sources
Reply Threaded More More options
Print post
Permalink
Some javascript/style in this post has been disabled (why?)
Re: [sonar-dev] Generated Sources Hi Freddy !
Hi Freddy !

That is the mojo header:

/** * Create SonarJ dependency XML report. * * @goal sonarj * @phase verify */


The strange thing is if you execute sonar:sonar with "-Dsonar.phase=generate-sources" our plugin gets the generated sources directory injected, otherwise not.

If I call the plugin manually I only get the generated sources if I call “mvn generate-sources sonarj:sonarj”.

I think the reason for this is that the source generation plugins add more enries to project.compileSourceRoots. So if the code generation plugin is not called during the maven invocation Maven does not know these directories.

Do you have any smart idea how to solve this without having to use the –D... Switch?

Regards

Alexander

On 10/19/09 2:58 PM, "Freddy Mallet" <freddy.mallet@...> wrote:

Hello Alexander,

Perhaps my first explanation was not totally clear. I guess you've developed a Sonar plugin which configures and launches the SonarJ Maven Plugin. Even if this SonarJ Maven plugin is launched by Sonar, it has its own Maven lifecycle. So if your SonarJ Maven Plugin depends on the Maven verify phase, this phase should be automatically launched by Maven. There is in fact absolutely no difference between launching the SonarJ Maven Plugin by hand or through Sonar.

When you say that your SonarJ Maven Plugin runs in the verify phase, do you mean that you've added the annotation "@goal verirfy" to your SonarJ Mojo ?

http://maven.apache.org/guides/plugin/guide-java-plugin-development.html

Hope it helps,
Freddy


On Mon, Oct 19, 2009 at 6:17 PM, Alexander von Zitzewitz <a.zitzewitz@...> wrote:
Hello Freddy !

I am not sure if I am really happy with that. Our SonarJ Maven Plugin runs in the verify phase, so it assumes, that code is generated. On the other hand I can understand, that nobody wants to analyze generated code with Checkstyle. Isn’t here a possibility that the Plugin Handler tells Sonar if he expects generated sources or not? Probably this requirement really depends on the plugin to be run.

Best regards


Alexander



On 10/14/09 5:08 PM, "Freddy Mallet" <freddy.mallet@... <http://freddy.mallet@...> > wrote:

Hello Alexander,

Sorry for this late answer.

target/generated-sources can be analyzed by Sonar but in that case the Maven phase "generated-sources" must be first called. For this, you must tell Sonar to call this phase by adding the parameter "-Dsonar.phase=generate-sources" to the "mvn sonar:sonar" command.

regards,
Freddy


On Mon, Oct 12, 2009 at 11:41 PM, Alexander von Zitzewitz <a.zitzewitz@... <http://a.zitzewitz@...> > wrote:
Hello !

Looks like target/generated-sources is ommited from Sonar Analysis. Is this by intention?

Best regards

Alexander von Zitzewitz



www.hello2morrow.com <http://www.hello2morrow.com>  <http://www.hello2morrow.com>

SonarJ Elevator Pitch: http://www.hello2morrow.com/videos/benefits

+1 (877) 294-6327





Alexander von Zitzewitz



www.hello2morrow.com <http://www.hello2morrow.com>

SonarJ Elevator Pitch: http://www.hello2morrow.com/videos/benefits

+1 (877) 294-6327





Alexander von Zitzewitz



www.hello2morrow.com

SonarJ Elevator Pitch: http://www.hello2morrow.com/videos/benefits

+1 (877) 294-6327





Olivier Gaudin () Re: Generated Sources
Reply Threaded More More options
Print post
Permalink
Hello Alexander,

There must be an issue in your sonarj maven plugin as it should "generate the sources" without calling explicitly calling generate-sources goal. Once this is resolved, it is going to work smoothly in Sonar :-)

Olivier



On Mon, Oct 19, 2009 at 9:57 PM, Alexander von Zitzewitz <[hidden email]> wrote:
Hi Freddy !
Hi Freddy !

That is the mojo header:

/** * Create SonarJ dependency XML report. * * @goal sonarj * @phase verify */


The strange thing is if you execute sonar:sonar with "-Dsonar.phase=generate-sources" our plugin gets the generated sources directory injected, otherwise not.

If I call the plugin manually I only get the generated sources if I call “mvn generate-sources sonarj:sonarj”.

I think the reason for this is that the source generation plugins add more enries to project.compileSourceRoots. So if the code generation plugin is not called during the maven invocation Maven does not know these directories.

Do you have any smart idea how to solve this without having to use the –D... Switch?

Regards

Alexander


On 10/19/09 2:58 PM, "Freddy Mallet" <freddy.mallet@...> wrote:

Hello Alexander,

Perhaps my first explanation was not totally clear. I guess you've developed a Sonar plugin which configures and launches the SonarJ Maven Plugin. Even if this SonarJ Maven plugin is launched by Sonar, it has its own Maven lifecycle. So if your SonarJ Maven Plugin depends on the Maven verify phase, this phase should be automatically launched by Maven. There is in fact absolutely no difference between launching the SonarJ Maven Plugin by hand or through Sonar.

When you say that your SonarJ Maven Plugin runs in the verify phase, do you mean that you've added the annotation "@goal verirfy" to your SonarJ Mojo ?

http://maven.apache.org/guides/plugin/guide-java-plugin-development.html

Hope it helps,
Freddy


On Mon, Oct 19, 2009 at 6:17 PM, Alexander von Zitzewitz <a.zitzewitz@...> wrote:
Hello Freddy !

I am not sure if I am really happy with that. Our SonarJ Maven Plugin runs in the verify phase, so it assumes, that code is generated. On the other hand I can understand, that nobody wants to analyze generated code with Checkstyle. Isn’t here a possibility that the Plugin Handler tells Sonar if he expects generated sources or not? Probably this requirement really depends on the plugin to be run.

Best regards


Alexander



On 10/14/09 5:08 PM, "Freddy Mallet" <freddy.mallet@... <http://freddy.mallet@...> > wrote:

Hello Alexander,

Sorry for this late answer.

target/generated-sources can be analyzed by Sonar but in that case the Maven phase "generated-sources" must be first called. For this, you must tell Sonar to call this phase by adding the parameter "-Dsonar.phase=generate-sources" to the "mvn sonar:sonar" command.

regards,
Freddy


On Mon, Oct 12, 2009 at 11:41 PM, Alexander von Zitzewitz <a.zitzewitz@... <http://a.zitzewitz@...> > wrote:
Hello !

Looks like target/generated-sources is ommited from Sonar Analysis. Is this by intention?

Best regards

Alexander von Zitzewitz



www.hello2morrow.com <http://www.hello2morrow.com>  <http://www.hello2morrow.com>

SonarJ Elevator Pitch: http://www.hello2morrow.com/videos/benefits

+1 (877) 294-6327





Alexander von Zitzewitz



www.hello2morrow.com <http://www.hello2morrow.com>

SonarJ Elevator Pitch: http://www.hello2morrow.com/videos/benefits

+1 (877) 294-6327





Alexander von Zitzewitz



www.hello2morrow.com

SonarJ Elevator Pitch: http://www.hello2morrow.com/videos/benefits

+1 (877) 294-6327






Alexander von Zitzewitz () Re: Generated Sources
Reply Threaded More More options
Print post
Permalink
Some javascript/style in this post has been disabled (why?)
Re: [sonar-dev] Generated Sources Hello Olivier !

I tried a couple of things. First of all I think Maven only executes a the plugin and not any other phases when you call it explicitly like in mvn sonar:sonar or maven sonarj:sonarj. Obviously calling “mvn sonar:sonar” does not execute the generate-sources phase.

If you call mvn verify” our plugin is only executed when an execution is added to the pom.  I think that is also to be expected.

I have no idea how to find out in which context our Mojo is executed and how to make sure, that sources are generated before it executes. I searched the web but did not find any good hint about it. Maybe I am understanding something in the wrong way.

Thanks for any idea in advance.

Regards


Alexander

Btw, the svn issue is solved now...


On 10/20/09 9:39 AM, "Olivier Gaudin" <olivier.gaudin@...> wrote:

Hello Alexander,

There must be an issue in your sonarj maven plugin as it should "generate the sources" without calling explicitly calling generate-sources goal. Once this is resolved, it is going to work smoothly in Sonar :-)

Olivier



On Mon, Oct 19, 2009 at 9:57 PM, Alexander von Zitzewitz <a.zitzewitz@...> wrote:
Hi Freddy !
Hi Freddy !

That is the mojo header:

/** * Create SonarJ dependency XML report. *  * @goal sonarj * @phase verify */


The strange thing is if you execute sonar:sonar with "-Dsonar.phase=generate-sources" our plugin gets the generated sources directory injected, otherwise not.

If I call the plugin manually I only get the generated sources if I call “mvn generate-sources sonarj:sonarj”.

I think the reason for this is that the source generation plugins add more enries to project.compileSourceRoots. So if the code generation plugin is not called during the maven invocation Maven does not know these directories.

Do you have any smart idea how to solve this without having to use the –D... Switch?

Regards

Alexander


On 10/19/09 2:58 PM, "Freddy Mallet" <freddy.mallet@... <http://freddy.mallet@...> > wrote:

Hello Alexander,

Perhaps my first explanation was not totally clear. I guess you've developed a Sonar plugin which configures and launches the SonarJ Maven Plugin. Even if this SonarJ Maven plugin is launched by Sonar, it has its own Maven lifecycle. So if your SonarJ Maven Plugin depends on the Maven verify phase, this phase should be automatically launched by Maven. There is in fact absolutely no difference between launching the SonarJ Maven Plugin by hand or through Sonar.

When you say that your SonarJ Maven Plugin runs in the verify phase, do you mean that you've added the annotation "@goal verirfy" to your SonarJ Mojo ?

http://maven.apache.org/guides/plugin/guide-java-plugin-development.html

Hope it helps,
Freddy


On Mon, Oct 19, 2009 at 6:17 PM, Alexander von Zitzewitz <a.zitzewitz@... <http://a.zitzewitz@...> > wrote:
Hello Freddy !

I am not sure if I am really happy with that. Our SonarJ Maven Plugin runs in the verify phase, so it assumes, that code is generated. On the other hand I can understand, that nobody wants to analyze generated code with Checkstyle. Isn’t here a possibility that the Plugin Handler tells Sonar if he expects generated sources or not? Probably this requirement really depends on the plugin to be run.

Best regards


Alexander



On 10/14/09 5:08 PM, "Freddy Mallet" <freddy.mallet@... <http://freddy.mallet@...>  <http://freddy.mallet@...> > wrote:

Hello Alexander,

Sorry for this late answer.

target/generated-sources can be analyzed by Sonar but in that case the Maven phase "generated-sources" must be first called. For this, you must tell Sonar to call this phase by adding the parameter "-Dsonar.phase=generate-sources" to the "mvn sonar:sonar" command.

regards,
Freddy


On Mon, Oct 12, 2009 at 11:41 PM, Alexander von Zitzewitz <a.zitzewitz@... <http://a.zitzewitz@...>  <http://a.zitzewitz@...> > wrote:
Hello !

Looks like target/generated-sources is ommited from Sonar Analysis. Is this by intention?

Best regards

Alexander von Zitzewitz



www.hello2morrow.com <http://www.hello2morrow.com>  <http://www.hello2morrow.com>  <http://www.hello2morrow.com>

SonarJ Elevator Pitch: http://www.hello2morrow.com/videos/benefits

+1 (877) 294-6327





Alexander von Zitzewitz



www.hello2morrow.com <http://www.hello2morrow.com>  <http://www.hello2morrow.com>

SonarJ Elevator Pitch: http://www.hello2morrow.com/videos/benefits

+1 (877) 294-6327





Alexander von Zitzewitz



www.hello2morrow.com <http://www.hello2morrow.com>

SonarJ Elevator Pitch: http://www.hello2morrow.com/videos/benefits

+1 (877) 294-6327





Alexander von Zitzewitz



www.hello2morrow.com

SonarJ Elevator Pitch: http://www.hello2morrow.com/videos/benefits

+1 (877) 294-6327






Olivier Gaudin () Re: Generated Sources
Reply Threaded More More options
Print post
Permalink
Hello Alexander,

Obviously calling “mvn sonar:sonar” does not execute the generate-sources phase.
It would if the sonar goal was attached to any phase above generate-sources

Where is your sonarj maven plugin defined ?

Olivier



On Tue, Oct 20, 2009 at 6:28 PM, Alexander von Zitzewitz <[hidden email]> wrote:
Hello Olivier !

I tried a couple of things. First of all I think Maven only executes a the plugin and not any other phases when you call it explicitly like in mvn sonar:sonar or maven sonarj:sonarj. Obviously calling “mvn sonar:sonar” does not execute the generate-sources phase.

If you call mvn verify” our plugin is only executed when an execution is added to the pom.  I think that is also to be expected.

I have no idea how to find out in which context our Mojo is executed and how to make sure, that sources are generated before it executes. I searched the web but did not find any good hint about it. Maybe I am understanding something in the wrong way.

Thanks for any idea in advance.

Regards


Alexander

Btw, the svn issue is solved now...



On 10/20/09 9:39 AM, "Olivier Gaudin" <olivier.gaudin@...> wrote:

Hello Alexander,

There must be an issue in your sonarj maven plugin as it should "generate the sources" without calling explicitly calling generate-sources goal. Once this is resolved, it is going to work smoothly in Sonar :-)

Olivier



On Mon, Oct 19, 2009 at 9:57 PM, Alexander von Zitzewitz <a.zitzewitz@...> wrote:
Hi Freddy !
Hi Freddy !

That is the mojo header:

/** * Create SonarJ dependency XML report. *  * @goal sonarj * @phase verify */


The strange thing is if you execute sonar:sonar with "-Dsonar.phase=generate-sources" our plugin gets the generated sources directory injected, otherwise not.

If I call the plugin manually I only get the generated sources if I call “mvn generate-sources sonarj:sonarj”.

I think the reason for this is that the source generation plugins add more enries to project.compileSourceRoots. So if the code generation plugin is not called during the maven invocation Maven does not know these directories.

Do you have any smart idea how to solve this without having to use the –D... Switch?

Regards

Alexander


On 10/19/09 2:58 PM, "Freddy Mallet" <freddy.mallet@... <http://freddy.mallet@...> > wrote:

Hello Alexander,

Perhaps my first explanation was not totally clear. I guess you've developed a Sonar plugin which configures and launches the SonarJ Maven Plugin. Even if this SonarJ Maven plugin is launched by Sonar, it has its own Maven lifecycle. So if your SonarJ Maven Plugin depends on the Maven verify phase, this phase should be automatically launched by Maven. There is in fact absolutely no difference between launching the SonarJ Maven Plugin by hand or through Sonar.

When you say that your SonarJ Maven Plugin runs in the verify phase, do you mean that you've added the annotation "@goal verirfy" to your SonarJ Mojo ?

http://maven.apache.org/guides/plugin/guide-java-plugin-development.html

Hope it helps,
Freddy


On Mon, Oct 19, 2009 at 6:17 PM, Alexander von Zitzewitz <a.zitzewitz@... <http://a.zitzewitz@...> > wrote:
Hello Freddy !

I am not sure if I am really happy with that. Our SonarJ Maven Plugin runs in the verify phase, so it assumes, that code is generated. On the other hand I can understand, that nobody wants to analyze generated code with Checkstyle. Isn’t here a possibility that the Plugin Handler tells Sonar if he expects generated sources or not? Probably this requirement really depends on the plugin to be run.

Best regards


Alexander



On 10/14/09 5:08 PM, "Freddy Mallet" <freddy.mallet@... <http://freddy.mallet@...>  <http://freddy.mallet@...> > wrote:

Hello Alexander,

Sorry for this late answer.

target/generated-sources can be analyzed by Sonar but in that case the Maven phase "generated-sources" must be first called. For this, you must tell Sonar to call this phase by adding the parameter "-Dsonar.phase=generate-sources" to the "mvn sonar:sonar" command.

regards,
Freddy


On Mon, Oct 12, 2009 at 11:41 PM, Alexander von Zitzewitz <a.zitzewitz@... <http://a.zitzewitz@...>  <http://a.zitzewitz@...> > wrote:
Hello !

Looks like target/generated-sources is ommited from Sonar Analysis. Is this by intention?

Best regards

Alexander von Zitzewitz



www.hello2morrow.com <http://www.hello2morrow.com>  <http://www.hello2morrow.com>  <http://www.hello2morrow.com>

SonarJ Elevator Pitch: http://www.hello2morrow.com/videos/benefits

+1 (877) 294-6327







Alexander von Zitzewitz



www.hello2morrow.com <http://www.hello2morrow.com>

SonarJ Elevator Pitch: http://www.hello2morrow.com/videos/benefits

+1 (877) 294-6327





Alexander von Zitzewitz



www.hello2morrow.com

SonarJ Elevator Pitch: http://www.hello2morrow.com/videos/benefits

+1 (877) 294-6327







Alexander von Zitzewitz () Re: Generated Sources
Reply Threaded More More options
Print post
Permalink
Some javascript/style in this post has been disabled (why?)
Re: [sonar-dev] Generated Sources Hello Olivier !

  <pluginRepositories>    <pluginRepository>      <id>hello2morrow.maven.repository</id>      <url>http://maven.hello2morrow.com/repository</url>    </pluginRepository>  </pluginRepositories>
But you need a license to execute it. (Free eval licenses are available after registering on www.hello2morrow.com)

How do I attach a goal to a phase?

/**
 * Create SonarJ dependency XML report.
 *
 * @goal sonarj
 * @phase verify
 */

This is the current Mojo header of our plugin. Doesn’t this attach the goal sonarj to the verify phase?

For the sonar plugin you need version 5.0.2 of our plugin which is not uploaded to the repository yet.

Regards

Alexander

On 10/20/09 3:43 PM, "Olivier Gaudin" <olivier.gaudin@...> wrote:

Hello Alexander,

Obviously calling “mvn sonar:sonar” does not execute the generate-sources phase.
It would if the sonar goal was attached to any phase above generate-sources

Where is your sonarj maven plugin defined ?

Olivier



On Tue, Oct 20, 2009 at 6:28 PM, Alexander von Zitzewitz <a.zitzewitz@...> wrote:
Hello Olivier !

I tried a couple of things. First of all I think Maven only executes a the plugin and not any other phases when you call it explicitly like in mvn sonar:sonar or maven sonarj:sonarj. Obviously calling “mvn sonar:sonar” does not execute the generate-sources phase.

If you call mvn verify” our plugin is only executed when an execution is added to the pom.  I think that is also to be expected.

I have no idea how to find out in which context our Mojo is executed and how to make sure, that sources are generated before it executes. I searched the web but did not find any good hint about it. Maybe I am understanding something in the wrong way.

Thanks for any idea in advance.

Regards


Alexander

Btw, the svn issue is solved now...



On 10/20/09 9:39 AM, "Olivier Gaudin" <olivier.gaudin@... <http://olivier.gaudin@...> > wrote:

Hello Alexander,

There must be an issue in your sonarj maven plugin as it should "generate the sources" without calling explicitly calling generate-sources goal. Once this is resolved, it is going to work smoothly in Sonar :-)

Olivier



On Mon, Oct 19, 2009 at 9:57 PM, Alexander von Zitzewitz <a.zitzewitz@... <http://a.zitzewitz@...> > wrote:
Hi Freddy !
Hi Freddy !

That is the mojo header:

/** * Create SonarJ dependency XML report. *  * @goal sonarj * @phase verify */


The strange thing is if you execute sonar:sonar with "-Dsonar.phase=generate-sources" our plugin gets the generated sources directory injected, otherwise not.

If I call the plugin manually I only get the generated sources if I call “mvn generate-sources sonarj:sonarj”.

I think the reason for this is that the source generation plugins add more enries to project.compileSourceRoots. So if the code generation plugin is not called during the maven invocation Maven does not know these directories.

Do you have any smart idea how to solve this without having to use the –D... Switch?

Regards

Alexander


On 10/19/09 2:58 PM, "Freddy Mallet" <freddy.mallet@... <http://freddy.mallet@...>  <http://freddy.mallet@...> > wrote:

Hello Alexander,

Perhaps my first explanation was not totally clear. I guess you've developed a Sonar plugin which configures and launches the SonarJ Maven Plugin. Even if this SonarJ Maven plugin is launched by Sonar, it has its own Maven lifecycle. So if your SonarJ Maven Plugin depends on the Maven verify phase, this phase should be automatically launched by Maven. There is in fact absolutely no difference between launching the SonarJ Maven Plugin by hand or through Sonar.

When you say that your SonarJ Maven Plugin runs in the verify phase, do you mean that you've added the annotation "@goal verirfy" to your SonarJ Mojo ?

http://maven.apache.org/guides/plugin/guide-java-plugin-development.html

Hope it helps,
Freddy


On Mon, Oct 19, 2009 at 6:17 PM, Alexander von Zitzewitz <a.zitzewitz@... <http://a.zitzewitz@...>  <http://a.zitzewitz@...> > wrote:
Hello Freddy !

I am not sure if I am really happy with that. Our SonarJ Maven Plugin runs in the verify phase, so it assumes, that code is generated. On the other hand I can understand, that nobody wants to analyze generated code with Checkstyle. Isn’t here a possibility that the Plugin Handler tells Sonar if he expects generated sources or not? Probably this requirement really depends on the plugin to be run.

Best regards


Alexander



On 10/14/09 5:08 PM, "Freddy Mallet" <freddy.mallet@... <http://freddy.mallet@...>  <http://freddy.mallet@...>  <http://freddy.mallet@...> > wrote:

Hello Alexander,

Sorry for this late answer.

target/generated-sources can be analyzed by Sonar but in that case the Maven phase "generated-sources" must be first called. For this, you must tell Sonar to call this phase by adding the parameter "-Dsonar.phase=generate-sources" to the "mvn sonar:sonar" command.

regards,
Freddy


On Mon, Oct 12, 2009 at 11:41 PM, Alexander von Zitzewitz <a.zitzewitz@... <http://a.zitzewitz@...>  <http://a.zitzewitz@...>  <http://a.zitzewitz@...> > wrote:
Hello !

Looks like target/generated-sources is ommited from Sonar Analysis. Is this by intention?

Best regards

Alexander von Zitzewitz



www.hello2morrow.com <http://www.hello2morrow.com>  <http://www.hello2morrow.com>  <http://www.hello2morrow.com>  <http://www.hello2morrow.com>

SonarJ Elevator Pitch: http://www.hello2morrow.com/videos/benefits

+1 (877) 294-6327





Alexander von Zitzewitz



www.hello2morrow.com <http://www.hello2morrow.com>  <http://www.hello2morrow.com>  <http://www.hello2morrow.com>

SonarJ Elevator Pitch: http://www.hello2morrow.com/videos/benefits

+1 (877) 294-6327





Alexander von Zitzewitz



www.hello2morrow.com <http://www.hello2morrow.com>  <http://www.hello2morrow.com>

SonarJ Elevator Pitch: http://www.hello2morrow.com/videos/benefits

+1 (877) 294-6327





Alexander von Zitzewitz



www.hello2morrow.com <http://www.hello2morrow.com>

SonarJ Elevator Pitch: http://www.hello2morrow.com/videos/benefits

+1 (877) 294-6327





Alexander von Zitzewitz



www.hello2morrow.com

SonarJ Elevator Pitch: http://www.hello2morrow.com/videos/benefits

+1 (877) 294-6327







Freddy Mallet () Re: Generated Sources
Reply Threaded More More options
Print post
Permalink
Hello Alexander,

Try to replace '@phase verify' by '@execute phase="generate-sources"'

Hope it helps,
Freddy

----------------------------------------
Freddy Mallet
www.SonarSource.com
Sonar.codehaus.org
http://twitter.com/FreddyMallet
----------------------------------------


On Tue, Oct 20, 2009 at 11:32 PM, Alexander von Zitzewitz <[hidden email]> wrote:
Hello Olivier !

  <pluginRepositories>    <pluginRepository>      <id>hello2morrow.maven.repository</id>      <url>http://maven.hello2morrow.com/repository</url>    </pluginRepository>  </pluginRepositories>
But you need a license to execute it. (Free eval licenses are available after registering on www.hello2morrow.com)

How do I attach a goal to a phase?


/**
 * Create SonarJ dependency XML report.
 *
 * @goal sonarj
 * @phase verify
 */

This is the current Mojo header of our plugin. Doesn’t this attach the goal sonarj to the verify phase?

For the sonar plugin you need version 5.0.2 of our plugin which is not uploaded to the repository yet.

Regards

Alexander


On 10/20/09 3:43 PM, "Olivier Gaudin" <olivier.gaudin@...> wrote:

Hello Alexander,

Obviously calling “mvn sonar:sonar” does not execute the generate-sources phase.
It would if the sonar goal was attached to any phase above generate-sources

Where is your sonarj maven plugin defined ?

Olivier



On Tue, Oct 20, 2009 at 6:28 PM, Alexander von Zitzewitz <a.zitzewitz@...> wrote:
Hello Olivier !

I tried a couple of things. First of all I think Maven only executes a the plugin and not any other phases when you call it explicitly like in mvn sonar:sonar or maven sonarj:sonarj. Obviously calling “mvn sonar:sonar” does not execute the generate-sources phase.

If you call mvn verify” our plugin is only executed when an execution is added to the pom.  I think that is also to be expected.

I have no idea how to find out in which context our Mojo is executed and how to make sure, that sources are generated before it executes. I searched the web but did not find any good hint about it. Maybe I am understanding something in the wrong way.

Thanks for any idea in advance.

Regards


Alexander

Btw, the svn issue is solved now...



On 10/20/09 9:39 AM, "Olivier Gaudin" <olivier.gaudin@... <http://olivier.gaudin@...> > wrote:

Hello Alexander,

There must be an issue in your sonarj maven plugin as it should "generate the sources" without calling explicitly calling generate-sources goal. Once this is resolved, it is going to work smoothly in Sonar :-)

Olivier



On Mon, Oct 19, 2009 at 9:57 PM, Alexander von Zitzewitz <a.zitzewitz@... <http://a.zitzewitz@...> > wrote:
Hi Freddy !
Hi Freddy !

That is the mojo header:

/** * Create SonarJ dependency XML report. *  * @goal sonarj * @phase verify */


The strange thing is if you execute sonar:sonar with "-Dsonar.phase=generate-sources" our plugin gets the generated sources directory injected, otherwise not.

If I call the plugin manually I only get the generated sources if I call “mvn generate-sources sonarj:sonarj”.

I think the reason for this is that the source generation plugins add more enries to project.compileSourceRoots. So if the code generation plugin is not called during the maven invocation Maven does not know these directories.

Do you have any smart idea how to solve this without having to use the –D... Switch?

Regards

Alexander


On 10/19/09 2:58 PM, "Freddy Mallet" <freddy.mallet@... <http://freddy.mallet@...>  <http://freddy.mallet@...> > wrote:

Hello Alexander,

Perhaps my first explanation was not totally clear. I guess you've developed a Sonar plugin which configures and launches the SonarJ Maven Plugin. Even if this SonarJ Maven plugin is launched by Sonar, it has its own Maven lifecycle. So if your SonarJ Maven Plugin depends on the Maven verify phase, this phase should be automatically launched by Maven. There is in fact absolutely no difference between launching the SonarJ Maven Plugin by hand or through Sonar.

When you say that your SonarJ Maven Plugin runs in the verify phase, do you mean that you've added the annotation "@goal verirfy" to your SonarJ Mojo ?

http://maven.apache.org/guides/plugin/guide-java-plugin-development.html

Hope it helps,
Freddy


On Mon, Oct 19, 2009 at 6:17 PM, Alexander von Zitzewitz <a.zitzewitz@... <http://a.zitzewitz@...>  <http://a.zitzewitz@...> > wrote:
Hello Freddy !

I am not sure if I am really happy with that. Our SonarJ Maven Plugin runs in the verify phase, so it assumes, that code is generated. On the other hand I can understand, that nobody wants to analyze generated code with Checkstyle. Isn’t here a possibility that the Plugin Handler tells Sonar if he expects generated sources or not? Probably this requirement really depends on the plugin to be run.

Best regards


Alexander



On 10/14/09 5:08 PM, "Freddy Mallet" <freddy.mallet@... <http://freddy.mallet@...>  <http://freddy.mallet@...>  <http://freddy.mallet@...> > wrote:

Hello Alexander,

Sorry for this late answer.

target/generated-sources can be analyzed by Sonar but in that case the Maven phase "generated-sources" must be first called. For this, you must tell Sonar to call this phase by adding the parameter "-Dsonar.phase=generate-sources" to the "mvn sonar:sonar" command.

regards,
Freddy


On Mon, Oct 12, 2009 at 11:41 PM, Alexander von Zitzewitz <a.zitzewitz@... <http://a.zitzewitz@...>  <http://a.zitzewitz@...>  <http://a.zitzewitz@...> > wrote:
Hello !

Looks like target/generated-sources is ommited from Sonar Analysis. Is this by intention?

Best regards

Alexander von Zitzewitz



www.hello2morrow.com <http://www.hello2morrow.com>  <http://www.hello2morrow.com>  <http://www.hello2morrow.com>  <http://www.hello2morrow.com>

SonarJ Elevator Pitch: http://www.hello2morrow.com/videos/benefits

+1 (877) 294-6327





Alexander von Zitzewitz



www.hello2morrow.com <http://www.hello2morrow.com>  <http://www.hello2morrow.com>  <http://www.hello2morrow.com>

SonarJ Elevator Pitch: http://www.hello2morrow.com/videos/benefits

+1 (877) 294-6327





Alexander von Zitzewitz



www.hello2morrow.com <http://www.hello2morrow.com>  <http://www.hello2morrow.com>

SonarJ Elevator Pitch: http://www.hello2morrow.com/videos/benefits

+1 (877) 294-6327





Alexander von Zitzewitz



www.hello2morrow.com <http://www.hello2morrow.com>

SonarJ Elevator Pitch: http://www.hello2morrow.com/videos/benefits

+1 (877) 294-6327





Alexander von Zitzewitz



www.hello2morrow.com

SonarJ Elevator Pitch: http://www.hello2morrow.com/videos/benefits

+1 (877) 294-6327








Alexander von Zitzewitz () Re: Generated Sources
Reply Threaded More More options
Print post
Permalink
Some javascript/style in this post has been disabled (why?)
Re: [sonar-dev] Generated Sources Thanks – that hint did it ;-)


On 10/21/09 9:13 AM, "Freddy Mallet" <freddy.mallet@...> wrote:

Hello Alexander,

Try to replace '@phase verify' by '@execute phase="generate-sources"'

Hope it helps,
Freddy

----------------------------------------
Freddy Mallet
www.SonarSource.com <http://www.SonarSource.com>
Sonar.codehaus.org <http://Sonar.codehaus.org>
http://twitter.com/FreddyMallet
----------------------------------------


On Tue, Oct 20, 2009 at 11:32 PM, Alexander von Zitzewitz <a.zitzewitz@...> wrote:
Hello Olivier !

  <pluginRepositories>    <pluginRepository>      <id>hello2morrow.maven.repository</id>      <url>http://maven.hello2morrow.com/repository <http://maven.hello2morrow.com/repository> </url>    </pluginRepository>  </pluginRepositories>
But you need a license to execute it. (Free eval licenses are available after registering on www.hello2morrow.com <http://www.hello2morrow.com> )

How do I attach a goal to a phase?


/**
 * Create SonarJ dependency XML report.
 *
 * @goal sonarj
 * @phase verify
 */

This is the current Mojo header of our plugin. Doesn’t this attach the goal sonarj to the verify phase?

For the sonar plugin you need version 5.0.2 of our plugin which is not uploaded to the repository yet.

Regards

Alexander


On 10/20/09 3:43 PM, "Olivier Gaudin" <olivier.gaudin@... <http://olivier.gaudin@...> > wrote:

Hello Alexander,

Obviously calling “mvn sonar:sonar” does not execute the generate-sources phase.
It would if the sonar goal was attached to any phase above generate-sources

Where is your sonarj maven plugin defined ?

Olivier



On Tue, Oct 20, 2009 at 6:28 PM, Alexander von Zitzewitz <a.zitzewitz@... <http://a.zitzewitz@...> > wrote:
Hello Olivier !

I tried a couple of things. First of all I think Maven only executes a the plugin and not any other phases when you call it explicitly like in mvn sonar:sonar or maven sonarj:sonarj. Obviously calling “mvn sonar:sonar” does not execute the generate-sources phase.

If you call mvn verify” our plugin is only executed when an execution is added to the pom.  I think that is also to be expected.

I have no idea how to find out in which context our Mojo is executed and how to make sure, that sources are generated before it executes. I searched the web but did not find any good hint about it. Maybe I am understanding something in the wrong way.

Thanks for any idea in advance.

Regards


Alexander

Btw, the svn issue is solved now...



On 10/20/09 9:39 AM, "Olivier Gaudin" <olivier.gaudin@... <http://olivier.gaudin@...>  <http://olivier.gaudin@...> > wrote:

Hello Alexander,

There must be an issue in your sonarj maven plugin as it should "generate the sources" without calling explicitly calling generate-sources goal. Once this is resolved, it is going to work smoothly in Sonar :-)

Olivier



On Mon, Oct 19, 2009 at 9:57 PM, Alexander von Zitzewitz <a.zitzewitz@... <http://a.zitzewitz@...>  <http://a.zitzewitz@...> > wrote:
Hi Freddy !
Hi Freddy !

That is the mojo header:

/** * Create SonarJ dependency XML report. *  * @goal sonarj * @phase verify */


The strange thing is if you execute sonar:sonar with "-Dsonar.phase=generate-sources" our plugin gets the generated sources directory injected, otherwise not.

If I call the plugin manually I only get the generated sources if I call “mvn generate-sources sonarj:sonarj”.

I think the reason for this is that the source generation plugins add more enries to project.compileSourceRoots. So if the code generation plugin is not called during the maven invocation Maven does not know these directories.

Do you have any smart idea how to solve this without having to use the –D... Switch?

Regards

Alexander


On 10/19/09 2:58 PM, "Freddy Mallet" <freddy.mallet@... <http://freddy.mallet@...>  <http://freddy.mallet@...>  <http://freddy.mallet@...> > wrote:

Hello Alexander,

Perhaps my first explanation was not totally clear. I guess you've developed a Sonar plugin which configures and launches the SonarJ Maven Plugin. Even if this SonarJ Maven plugin is launched by Sonar, it has its own Maven lifecycle. So if your SonarJ Maven Plugin depends on the Maven verify phase, this phase should be automatically launched by Maven. There is in fact absolutely no difference between launching the SonarJ Maven Plugin by hand or through Sonar.

When you say that your SonarJ Maven Plugin runs in the verify phase, do you mean that you've added the annotation "@goal verirfy" to your SonarJ Mojo ?

http://maven.apache.org/guides/plugin/guide-java-plugin-development.html

Hope it helps,
Freddy


On Mon, Oct 19, 2009 at 6:17 PM, Alexander von Zitzewitz <a.zitzewitz@... <http://a.zitzewitz@...>  <http://a.zitzewitz@...>  <http://a.zitzewitz@...> > wrote:
Hello Freddy !

I am not sure if I am really happy with that. Our SonarJ Maven Plugin runs in the verify phase, so it assumes, that code is generated. On the other hand I can understand, that nobody wants to analyze generated code with Checkstyle. Isn’t here a possibility that the Plugin Handler tells Sonar if he expects generated sources or not? Probably this requirement really depends on the plugin to be run.

Best regards


Alexander



On 10/14/09 5:08 PM, "Freddy Mallet" <freddy.mallet@... <http://freddy.mallet@...>  <http://freddy.mallet@...>  <http://freddy.mallet@...>  <http://freddy.mallet@...> > wrote:

Hello Alexander,

Sorry for this late answer.

target/generated-sources can be analyzed by Sonar but in that case the Maven phase "generated-sources" must be first called. For this, you must tell Sonar to call this phase by adding the parameter "-Dsonar.phase=generate-sources" to the "mvn sonar:sonar" command.

regards,
Freddy


On Mon, Oct 12, 2009 at 11:41 PM, Alexander von Zitzewitz <a.zitzewitz@... <http://a.zitzewitz@...>  <http://a.zitzewitz@...>  <http://a.zitzewitz@...>  <http://a.zitzewitz@...> > wrote:
Hello !

Looks like target/generated-sources is ommited from Sonar Analysis. Is this by intention?

Best regards

Alexander von Zitzewitz



www.hello2morrow.com <http://www.hello2morrow.com>  <http://www.hello2morrow.com>  <http://www.hello2morrow.com>  <http://www.hello2morrow.com>  <http://www.hello2morrow.com>

SonarJ Elevator Pitch: http://www.hello2morrow.com/videos/benefits

+1 (877) 294-6327





Alexander von Zitzewitz



www.hello2morrow.com <http://www.hello2morrow.com>  <http://www.hello2morrow.com>  <http://www.hello2morrow.com>  <http://www.hello2morrow.com>

SonarJ Elevator Pitch: http://www.hello2morrow.com/videos/benefits

+1 (877) 294-6327





Alexander von Zitzewitz



www.hello2morrow.com <http://www.hello2morrow.com>  <http://www.hello2morrow.com>  <http://www.hello2morrow.com>

SonarJ Elevator Pitch: http://www.hello2morrow.com/videos/benefits

+1 (877) 294-6327





Alexander von Zitzewitz



www.hello2morrow.com <http://www.hello2morrow.com>  <http://www.hello2morrow.com>

SonarJ Elevator Pitch: http://www.hello2morrow.com/videos/benefits

+1 (877) 294-6327





Alexander von Zitzewitz



www.hello2morrow.com <http://www.hello2morrow.com>

SonarJ Elevator Pitch: http://www.hello2morrow.com/videos/benefits

+1 (877) 294-6327





Alexander von Zitzewitz



www.hello2morrow.com

SonarJ Elevator Pitch: http://www.hello2morrow.com/videos/benefits

+1 (877) 294-6327