• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

Maven : Configuration ruleSet

New Here ,
Oct 02, 2009 Oct 02, 2009

Copy link to clipboard

Copied

Hi all!

When we launch flexpmd from the plugin maven, how could we indicate our xml rule file?


Indeed actually I run the plugin FlexPMD declared in my pom like this:

            <plugin>
                <groupId>com.adobe.ac</groupId>
                <artifactId>flex-pmd-maven-plugin</artifactId>
                <version>1.0.RC4</version>
            </plugin>

But it takes by defaults all the rules. I have tried to configure my pom (like it did with ant) bya adding a configuration section where i specify my xml rule file.

            <plugin>
                <groupId>com.adobe.ac</groupId>
                <artifactId>flex-pmd-maven-plugin</artifactId>
                <version>1.0.RC4</version>
                <configuration>
                    <ruleSet>pluginConfig/flexpmd.xml</ruleSet>
                </configuration>
            </plugin>

This fails unfortunatly

igreek

TOPICS
FlexPMD

Views

3.5K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Oct 05, 2009 Oct 05, 2009

Copy link to clipboard

Copied

Can you send the console log, please?

Xavier

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 05, 2009 Oct 05, 2009

Copy link to clipboard

Copied

Hi Xavier,

Here is the log of the error encountered:

[INFO] Generating "Flex PMD Report" report.
5 oct. 2009 13:56:57 com.adobe.ac.pmd.maven.AbstractFlexPmdMojo executeReport
INFO: FlexPmdMojo starts
5 oct. 2009 13:56:57 com.adobe.ac.pmd.engines.AbstractFlexPmdEngine <init>
ATTENTION: E:\TestFlexPMD\UnitedRetail_Product\ProductCodification\pluginConfig\
flexpmd.xml
(Le chemin d'accÞs spÚcifiÚ est introuvable) at java.io.FileInputStr
eam.open(Native Method)
java.io.FileInputStream.<init>(FileInputStream.java:106)
com.adobe.ac.pmd.engines.AbstractFlexPmdEngine.loadRuleset(AbstractFlexPmdEngine
.java:180)
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error during page generation

Embedded error: Error rendering Maven report: A system exception has been thrown

FlexPMD is trying to search the ruleSet configuration file flexpmd.xml in the wrong directory.

I'm using a relative path for the location of the ruleSet file by incorporing this file in a project build-tools (which is specified in the parent pom of my project as an extension). Itworks with my other quality tools (checkstyle, pmd java, etc.).

I tried to change the relative path by an absolute path and it works fine (but it is not what I really want).

            <plugin>
                <groupId>com.adobe.ac</groupId>
                <artifactId>flex-pmd-maven-plugin</artifactId>
                <version>1.0.RC4</version>
                <configuration>
                    <ruleSet>E:/pmd_all_rules.xml</ruleSet>       
                </configuration>
            </plugin>

Thanks for your reply

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Oct 05, 2009 Oct 05, 2009

Copy link to clipboard

Copied

Hi,

Can you try to use ${baseDir}/custom_ruleset.xml ?

Xavier

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 05, 2009 Oct 05, 2009

Copy link to clipboard

Copied

Xavier,

T tried what you said but it does works.

Now, my ruleSet configuration lokks like this:

<ruleSet>${basedir}/pluginConfig/pmd_all_rules.xml</ruleSet>

and it logs me the same message:

ATTENTION: E:\TestFlexPMD\UnitedRetail_Product\ProductCodification\pluginConfig\
pmd_all_rules.xml (Le chemin d'accÞs spÚcifiÚ est introuvable) at java.io.FileIn
putStream.open(Native Method)
java.io.FileInputStream.<init>(FileInputStream.java:106)
com.adobe.ac.pmd.engines.AbstractFlexPmdEngine.loadRuleset(AbstractFlexPmdEngine
.java:180)
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error during page generation

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 05, 2009 Oct 05, 2009

Copy link to clipboard

Copied

I add precision. My custom_rules.xlm is not located in the same project I'am analysing. It is located on another project which is shared with an extension section in the parent pom of my project. I don't know if I'm clear enough...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Oct 05, 2009 Oct 05, 2009

Copy link to clipboard

Copied

Can you:

- post your folder structure?

- specify where the flexPMD definition is declared in?

With this information, we will figure out how to work around this issue.

Xavier

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 05, 2009 Oct 05, 2009

Copy link to clipboard

Copied

xxxParentModule _____xxxFlexModule_____src

                          |                              _____pom.xml (1)

                          |_____pom.xml(2)


In the pom of my flex module (1) , I defined the flexPMD plugin.

In the pom of my parent module (2), it is defined an extension section in the build where I put my custom_ruleset.xml

This jar is added to the classpath.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Oct 05, 2009 Oct 05, 2009

Copy link to clipboard

Copied

In that case, can't you have something like:

<ruleSet>${baseDir}/../pluginConf/custom_rules.xml ?

Xavier

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Oct 06, 2009 Oct 06, 2009

Copy link to clipboard

Copied

Hi Xavier ,

igreek use other plugins (like java checkstyle..) and he put all configuration files (rule set) in one shared zip file. He include the latter file in the classpath by using the <extension> tags in the pom file of the parent project.

He can configure the java checkstyle to use a configuration file (rule set) stored in that zip file.

He want to do the same thing with the flex pmd plugin.

Java CheckStyle plugin is based on a RessourceManager class that locates the rules config file in the classpath :

org.codehaus.plexus.resource.ResourceManager;

ResourceManager locator;

/* @parameter */

private String configLocation;

File configFile = locator.getResourceAsFile( configLocation, "" );

However it doesn't seems to be the case in your flex pmd plugin.

Thanks for listening !

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Oct 06, 2009 Oct 06, 2009

Copy link to clipboard

Copied

Ok we have fix this problem. We modified the source code to work like the java checkstyle (see my previous message) ...

Also I would like to mention that in many cases the sourceDirectory propertie can change (for example when we generate automatically the source code from models -- MDA approach -- In that case we can put these files in a target "generated-sources" directory).

So it would be great if you delete the annotation "@readOnly" of the sourceDirectory parameter, so that we can configure the path to the source directory at the plugin declaration level (in the pom file).

Thanks !

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Oct 07, 2009 Oct 07, 2009

Copy link to clipboard

Copied

Hi,

I want also to avoid modifying your source code directly. To do that I wanted to extends your classes in the "flex-pmd-maven-plugin" and override methods with my specific needs. Unfortunately, you used the "Final" key word that disable the possibility of override. I find that we loose the flexibility, specially when it is an open source project.

regards,

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Oct 07, 2009 Oct 07, 2009

Copy link to clipboard

Copied

Hi!

First of all, thanks for spotting this one down. Feel free to create a new defect and attach the patch to it. I will integrate it in the next release candidate.

About the final keyword, I see your point. I am not sure which one you are talking about, but final makes sense in a lot of places.

It may makes sense to remove it for specific methods.

Best

Xavier

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 02, 2010 Mar 02, 2010

Copy link to clipboard

Copied

LATEST

Hi everyone

I faced with the same problem.

My FlexPmd.xml file is part of another project (myxxx-build-tools).

Project that I'm trying to launch has dependecy to the project with FlexPmd.xml:

<dependency>

            <groupId>com.xxx.xx</groupId>

            <artifactId>myxxx-build-tools</artifactId>

            <version>1.0-SNAPSHOT</version>

        </dependency>

Also from tutorial I put:

<reporting>

        <plugins>

            <plugin>

                <groupId>com.adobe.ac</groupId>

                <artifactId>flex-pmd-maven-plugin</artifactId>

                <version>1.0.RC5</version>

                <configuration>

                    <ruleSet>myxxx-build-tools/FlexPmd.xml</ruleSet>

                </configuration>

                <reportSets>

                </reportSets>

            </plugin>

        </plugins>

    </reporting>

When I'm trying to run mvn site plugin can't resolve path to my custom ruleset.

What I'm doing wrong, or could anyone give me some example of pom.xml files when custom ruleset belong to another project.

Thanks.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines