tags:

views:

167

answers:

1

I have a test project requiring some heavy jars which i put in ${M2_HOME}\test\src\main\resources\ and add them in the pom.xml using :

    <dependency>
        <groupId>server</groupId>
        <artifactId>server</artifactId>
        <version>1.0</version>
        <scope>system</scope>
        <systemPath>${M2_HOME}\test\src\main\resources\server.jar</systemPath>
    </dependency>
    <dependency>
        <groupId>client</groupId>
        <artifactId>client</artifactId>
        <version>6.0</version>
        <scope>system</scope>
        <systemPath>${M2_HOME}\test\src\main\resources\client.jar</systemPath>
    </dependency> 

I want to know if it possible to exclude them during sonar analysis, or generally just analyze java sources folder.

A: 

If the problem is that these JARs are included in sonar analysis because they are located in src/main/resources, then one obvious solution would be to put them somewhere else (see the post scriptum). If for whatever reason this is not possible, please clarify (I'd really like to know why you put these JARs under resources).

If the problem is that these JARs are declared as dependencies, you could use a specific profile not including them to run sonar.

PS: Note that using the system scope is a bad practice and has several drawbacks (as mentioned here or here). A cleaner approach would be to use a file based repository as suggested in this answer.

Pascal Thivent
thank you works great ! but what if i dont want to copy jars into maven repository ? and using 'em from enterprise repository to avoid duplication
achraf
@achraf I'm not sure to get the question. What would that change?
Pascal Thivent
@Pascal we have a quit heavy custom lib so just to save disk space
achraf
@achraf Ok, I get that. But from a Maven dependency point of view, I don't think it would change anything (just the repository location). Unless I missed something.
Pascal Thivent
@Pascal not just the repository location but also the possibility to use a secondary rep !
achraf