You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Iker Almandoz (JIRA)" <ji...@codehaus.org> on 2007/12/03 07:24:57 UTC

[jira] Created: (MDEP-122) Analyze target does not work correctly when only using a constant defined in a different module

Analyze target does not work correctly when only using a constant defined in a different module
-----------------------------------------------------------------------------------------------

                 Key: MDEP-122
                 URL: http://jira.codehaus.org/browse/MDEP-122
             Project: Maven 2.x Dependency Plugin
          Issue Type: Bug
    Affects Versions: 2.0-alpha-4
         Environment: Windows.
Maven 2.0.6
Java 1.5 compiler
            Reporter: Iker Almandoz
            Assignee: Brian Fox
            Priority: Minor
         Attachments: maven_bug.zip

I have 2 projects as seen in the attached files.
My first project contains a single interface that defines a String constant.
My second project, uses the String constant from my first project.

When i try to use dependency:analyze to fail the build as seen below, i can't make the system work.

If i add the dependency from project 2 to project 1, i get:
[INFO] [dependency:analyze {execution: analyze}]
[INFO] Used declared dependencies:
[INFO]    None
[INFO] Used undeclared dependencies:
[WARNING]    None
[INFO] Unused declared dependencies:
[INFO]    test:project1:jar: 1.0-SNAPSHOT:compile
[WARNING] Potential problems discovered.


But if i remove it, i get:
If i remove the supposedly unused dependency, then I get a compile error:
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Compilation failure
C:\ASSIA\development\maven_bug\project2\src\main\java\project2\NamesUser.java:[6
,24] package project1 does not exist


Here is the build definition i have...
    <build>
    <plugins>
     <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>analyze</id>
            <phase>package</phase>
            <goals>
              <goal>analyze</goal>
            </goals>
            <configuration>
                <failBuild>true</failBuild>
                <ignoreDirect>false</ignoreDirect>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>





-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] (MDEP-122) Analyze target does not work correctly when only using a constant defined in a different module

Posted by "Herve Boutemy (JIRA)" <ji...@codehaus.org>.
     [ https://jira.codehaus.org/browse/MDEP-122?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Herve Boutemy closed MDEP-122.
------------------------------

       Resolution: Fixed
    Fix Version/s: 2.6
         Assignee: Herve Boutemy  (was: Brian Fox)

done in [r1400674|http://svn.apache.org/viewvc?rev=1400674&view=rev]
                
> Analyze target does not work correctly when only using a constant defined in a different module
> -----------------------------------------------------------------------------------------------
>
>                 Key: MDEP-122
>                 URL: https://jira.codehaus.org/browse/MDEP-122
>             Project: Maven 2.x Dependency Plugin
>          Issue Type: Bug
>          Components: analyze
>    Affects Versions: 2.0-alpha-4
>         Environment: Windows.
> Maven 2.0.6
> Java 1.5 compiler
>            Reporter: Iker Almandoz
>            Assignee: Herve Boutemy
>            Priority: Minor
>             Fix For: 2.6
>
>         Attachments: analyze.zip, maven_bug.zip
>
>
> I have 2 projects as seen in the attached files.
> My first project contains a single interface that defines a String constant.
> My second project, uses the String constant from my first project.
> When i try to use dependency:analyze to fail the build as seen below, i can't make the system work.
> If i add the dependency from project 2 to project 1, i get:
> {noformat}[INFO] [dependency:analyze {execution: analyze}]
> [INFO] Used declared dependencies:
> [INFO]    None
> [INFO] Used undeclared dependencies:
> [WARNING]    None
> [INFO] Unused declared dependencies:
> [INFO]    test:project1:jar: 1.0-SNAPSHOT:compile
> [WARNING] Potential problems discovered.{noformat}
> But if i remove it, i get:
> If i remove the supposedly unused dependency, then I get a compile error:
> {noformat}[INFO] ------------------------------------------------------------------------
> [ERROR] BUILD FAILURE
> [INFO] ------------------------------------------------------------------------
> [INFO] Compilation failure
> C:\ASSIA\development\maven_bug\project2\src\main\java\project2\NamesUser.java:[6
> ,24] package project1 does not exist{noformat}
> Here is the build definition i have...
> {code:xml}    <build>
>     <plugins>
>      <plugin>
>         <groupId>org.apache.maven.plugins</groupId>
>         <artifactId>maven-dependency-plugin</artifactId>
>         <executions>
>           <execution>
>             <id>analyze</id>
>             <phase>package</phase>
>             <goals>
>               <goal>analyze</goal>
>             </goals>
>             <configuration>
>                 <failBuild>true</failBuild>
>                 <ignoreDirect>false</ignoreDirect>
>             </configuration>
>           </execution>
>         </executions>
>       </plugin>
>     </plugins>
>   </build>{code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] (MDEP-122) Analyze target does not work correctly when only using a constant defined in a different module

Posted by "Carsten Behring (JIRA)" <ji...@codehaus.org>.
    [ https://jira.codehaus.org/browse/MDEP-122?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=297315#comment-297315 ] 

Carsten Behring commented on MDEP-122:
--------------------------------------

I have a similar problem, if I use only annotations from a certain dependency.

In the case of using "project lombok", I add teh following to the pom.xml

<dependency>
                <groupId>org.projectlombok</groupId>
                <artifactId>lombok</artifactId>
                <version>0.11.0</version>
</dependency>


I think it's rather typical to use only annotations, if you use "project lombok". So by adding the annotations of the jar to my code:

import lombok.Getter;
import lombok.ToString;

@Getter
@ToString
public class xxxx {
}

the dependency plugins warns about 

[WARNING] Unused declared dependencies found:
[WARNING]    org.projectlombok:lombok:jar:0.11.0





                
> Analyze target does not work correctly when only using a constant defined in a different module
> -----------------------------------------------------------------------------------------------
>
>                 Key: MDEP-122
>                 URL: https://jira.codehaus.org/browse/MDEP-122
>             Project: Maven 2.x Dependency Plugin
>          Issue Type: Bug
>    Affects Versions: 2.0-alpha-4
>         Environment: Windows.
> Maven 2.0.6
> Java 1.5 compiler
>            Reporter: Iker Almandoz
>            Assignee: Brian Fox
>            Priority: Minor
>         Attachments: analyze.zip, maven_bug.zip
>
>
> I have 2 projects as seen in the attached files.
> My first project contains a single interface that defines a String constant.
> My second project, uses the String constant from my first project.
> When i try to use dependency:analyze to fail the build as seen below, i can't make the system work.
> If i add the dependency from project 2 to project 1, i get:
> [INFO] [dependency:analyze {execution: analyze}]
> [INFO] Used declared dependencies:
> [INFO]    None
> [INFO] Used undeclared dependencies:
> [WARNING]    None
> [INFO] Unused declared dependencies:
> [INFO]    test:project1:jar: 1.0-SNAPSHOT:compile
> [WARNING] Potential problems discovered.
> But if i remove it, i get:
> If i remove the supposedly unused dependency, then I get a compile error:
> [INFO] ------------------------------------------------------------------------
> [ERROR] BUILD FAILURE
> [INFO] ------------------------------------------------------------------------
> [INFO] Compilation failure
> C:\ASSIA\development\maven_bug\project2\src\main\java\project2\NamesUser.java:[6
> ,24] package project1 does not exist
> Here is the build definition i have...
>     <build>
>     <plugins>
>      <plugin>
>         <groupId>org.apache.maven.plugins</groupId>
>         <artifactId>maven-dependency-plugin</artifactId>
>         <executions>
>           <execution>
>             <id>analyze</id>
>             <phase>package</phase>
>             <goals>
>               <goal>analyze</goal>
>             </goals>
>             <configuration>
>                 <failBuild>true</failBuild>
>                 <ignoreDirect>false</ignoreDirect>
>             </configuration>
>           </execution>
>         </executions>
>       </plugin>
>     </plugins>
>   </build>

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] (MDEP-122) Analyze target does not work correctly when only using a constant defined in a different module

Posted by "Herve Boutemy (JIRA)" <ji...@codehaus.org>.
     [ https://jira.codehaus.org/browse/MDEP-122?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Herve Boutemy updated MDEP-122:
-------------------------------

    Component/s: analyze
    
> Analyze target does not work correctly when only using a constant defined in a different module
> -----------------------------------------------------------------------------------------------
>
>                 Key: MDEP-122
>                 URL: https://jira.codehaus.org/browse/MDEP-122
>             Project: Maven 2.x Dependency Plugin
>          Issue Type: Bug
>          Components: analyze
>    Affects Versions: 2.0-alpha-4
>         Environment: Windows.
> Maven 2.0.6
> Java 1.5 compiler
>            Reporter: Iker Almandoz
>            Assignee: Brian Fox
>            Priority: Minor
>         Attachments: analyze.zip, maven_bug.zip
>
>
> I have 2 projects as seen in the attached files.
> My first project contains a single interface that defines a String constant.
> My second project, uses the String constant from my first project.
> When i try to use dependency:analyze to fail the build as seen below, i can't make the system work.
> If i add the dependency from project 2 to project 1, i get:
> {noformat}[INFO] [dependency:analyze {execution: analyze}]
> [INFO] Used declared dependencies:
> [INFO]    None
> [INFO] Used undeclared dependencies:
> [WARNING]    None
> [INFO] Unused declared dependencies:
> [INFO]    test:project1:jar: 1.0-SNAPSHOT:compile
> [WARNING] Potential problems discovered.{noformat}
> But if i remove it, i get:
> If i remove the supposedly unused dependency, then I get a compile error:
> {noformat}[INFO] ------------------------------------------------------------------------
> [ERROR] BUILD FAILURE
> [INFO] ------------------------------------------------------------------------
> [INFO] Compilation failure
> C:\ASSIA\development\maven_bug\project2\src\main\java\project2\NamesUser.java:[6
> ,24] package project1 does not exist{noformat}
> Here is the build definition i have...
> {code:xml}    <build>
>     <plugins>
>      <plugin>
>         <groupId>org.apache.maven.plugins</groupId>
>         <artifactId>maven-dependency-plugin</artifactId>
>         <executions>
>           <execution>
>             <id>analyze</id>
>             <phase>package</phase>
>             <goals>
>               <goal>analyze</goal>
>             </goals>
>             <configuration>
>                 <failBuild>true</failBuild>
>                 <ignoreDirect>false</ignoreDirect>
>             </configuration>
>           </execution>
>         </executions>
>       </plugin>
>     </plugins>
>   </build>{code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] (MDEP-122) Analyze target does not work correctly when only using a constant defined in a different module

Posted by "Herve Boutemy (JIRA)" <ji...@codehaus.org>.
     [ https://jira.codehaus.org/browse/MDEP-122?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Herve Boutemy updated MDEP-122:
-------------------------------

    Description: 
I have 2 projects as seen in the attached files.
My first project contains a single interface that defines a String constant.
My second project, uses the String constant from my first project.

When i try to use dependency:analyze to fail the build as seen below, i can't make the system work.

If i add the dependency from project 2 to project 1, i get:
{noformat}[INFO] [dependency:analyze {execution: analyze}]
[INFO] Used declared dependencies:
[INFO]    None
[INFO] Used undeclared dependencies:
[WARNING]    None
[INFO] Unused declared dependencies:
[INFO]    test:project1:jar: 1.0-SNAPSHOT:compile
[WARNING] Potential problems discovered.{noformat}


But if i remove it, i get:
If i remove the supposedly unused dependency, then I get a compile error:
{noformat}[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Compilation failure
C:\ASSIA\development\maven_bug\project2\src\main\java\project2\NamesUser.java:[6
,24] package project1 does not exist{noformat}


Here is the build definition i have...
{code:xml}    <build>
    <plugins>
     <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>analyze</id>
            <phase>package</phase>
            <goals>
              <goal>analyze</goal>
            </goals>
            <configuration>
                <failBuild>true</failBuild>
                <ignoreDirect>false</ignoreDirect>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>{code}

  was:
I have 2 projects as seen in the attached files.
My first project contains a single interface that defines a String constant.
My second project, uses the String constant from my first project.

When i try to use dependency:analyze to fail the build as seen below, i can't make the system work.

If i add the dependency from project 2 to project 1, i get:
[INFO] [dependency:analyze {execution: analyze}]
[INFO] Used declared dependencies:
[INFO]    None
[INFO] Used undeclared dependencies:
[WARNING]    None
[INFO] Unused declared dependencies:
[INFO]    test:project1:jar: 1.0-SNAPSHOT:compile
[WARNING] Potential problems discovered.


But if i remove it, i get:
If i remove the supposedly unused dependency, then I get a compile error:
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Compilation failure
C:\ASSIA\development\maven_bug\project2\src\main\java\project2\NamesUser.java:[6
,24] package project1 does not exist


Here is the build definition i have...
    <build>
    <plugins>
     <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>analyze</id>
            <phase>package</phase>
            <goals>
              <goal>analyze</goal>
            </goals>
            <configuration>
                <failBuild>true</failBuild>
                <ignoreDirect>false</ignoreDirect>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>





    
> Analyze target does not work correctly when only using a constant defined in a different module
> -----------------------------------------------------------------------------------------------
>
>                 Key: MDEP-122
>                 URL: https://jira.codehaus.org/browse/MDEP-122
>             Project: Maven 2.x Dependency Plugin
>          Issue Type: Bug
>    Affects Versions: 2.0-alpha-4
>         Environment: Windows.
> Maven 2.0.6
> Java 1.5 compiler
>            Reporter: Iker Almandoz
>            Assignee: Brian Fox
>            Priority: Minor
>         Attachments: analyze.zip, maven_bug.zip
>
>
> I have 2 projects as seen in the attached files.
> My first project contains a single interface that defines a String constant.
> My second project, uses the String constant from my first project.
> When i try to use dependency:analyze to fail the build as seen below, i can't make the system work.
> If i add the dependency from project 2 to project 1, i get:
> {noformat}[INFO] [dependency:analyze {execution: analyze}]
> [INFO] Used declared dependencies:
> [INFO]    None
> [INFO] Used undeclared dependencies:
> [WARNING]    None
> [INFO] Unused declared dependencies:
> [INFO]    test:project1:jar: 1.0-SNAPSHOT:compile
> [WARNING] Potential problems discovered.{noformat}
> But if i remove it, i get:
> If i remove the supposedly unused dependency, then I get a compile error:
> {noformat}[INFO] ------------------------------------------------------------------------
> [ERROR] BUILD FAILURE
> [INFO] ------------------------------------------------------------------------
> [INFO] Compilation failure
> C:\ASSIA\development\maven_bug\project2\src\main\java\project2\NamesUser.java:[6
> ,24] package project1 does not exist{noformat}
> Here is the build definition i have...
> {code:xml}    <build>
>     <plugins>
>      <plugin>
>         <groupId>org.apache.maven.plugins</groupId>
>         <artifactId>maven-dependency-plugin</artifactId>
>         <executions>
>           <execution>
>             <id>analyze</id>
>             <phase>package</phase>
>             <goals>
>               <goal>analyze</goal>
>             </goals>
>             <configuration>
>                 <failBuild>true</failBuild>
>                 <ignoreDirect>false</ignoreDirect>
>             </configuration>
>           </execution>
>         </executions>
>       </plugin>
>     </plugins>
>   </build>{code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] (MDEP-122) Analyze target does not work correctly when only using a constant defined in a different module

Posted by "Herve Boutemy (JIRA)" <ji...@codehaus.org>.
    [ https://jira.codehaus.org/browse/MDEP-122?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=311752#comment-311752 ] 

Herve Boutemy commented on MDEP-122:
------------------------------------

I like <usedDependencies> to declare groupId:artifactId (without version) used but not automatically detected by (bytecode) analysis

Notice that if we add such an option, if a dependency is detected by bytecode analysis, it should be reported as a warning (to help people remove such manual declaration)
                
> Analyze target does not work correctly when only using a constant defined in a different module
> -----------------------------------------------------------------------------------------------
>
>                 Key: MDEP-122
>                 URL: https://jira.codehaus.org/browse/MDEP-122
>             Project: Maven 2.x Dependency Plugin
>          Issue Type: Bug
>    Affects Versions: 2.0-alpha-4
>         Environment: Windows.
> Maven 2.0.6
> Java 1.5 compiler
>            Reporter: Iker Almandoz
>            Assignee: Brian Fox
>            Priority: Minor
>         Attachments: analyze.zip, maven_bug.zip
>
>
> I have 2 projects as seen in the attached files.
> My first project contains a single interface that defines a String constant.
> My second project, uses the String constant from my first project.
> When i try to use dependency:analyze to fail the build as seen below, i can't make the system work.
> If i add the dependency from project 2 to project 1, i get:
> {noformat}[INFO] [dependency:analyze {execution: analyze}]
> [INFO] Used declared dependencies:
> [INFO]    None
> [INFO] Used undeclared dependencies:
> [WARNING]    None
> [INFO] Unused declared dependencies:
> [INFO]    test:project1:jar: 1.0-SNAPSHOT:compile
> [WARNING] Potential problems discovered.{noformat}
> But if i remove it, i get:
> If i remove the supposedly unused dependency, then I get a compile error:
> {noformat}[INFO] ------------------------------------------------------------------------
> [ERROR] BUILD FAILURE
> [INFO] ------------------------------------------------------------------------
> [INFO] Compilation failure
> C:\ASSIA\development\maven_bug\project2\src\main\java\project2\NamesUser.java:[6
> ,24] package project1 does not exist{noformat}
> Here is the build definition i have...
> {code:xml}    <build>
>     <plugins>
>      <plugin>
>         <groupId>org.apache.maven.plugins</groupId>
>         <artifactId>maven-dependency-plugin</artifactId>
>         <executions>
>           <execution>
>             <id>analyze</id>
>             <phase>package</phase>
>             <goals>
>               <goal>analyze</goal>
>             </goals>
>             <configuration>
>                 <failBuild>true</failBuild>
>                 <ignoreDirect>false</ignoreDirect>
>             </configuration>
>           </execution>
>         </executions>
>       </plugin>
>     </plugins>
>   </build>{code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (MDEP-122) Analyze target does not work correctly when only using a constant defined in a different module

Posted by "Benjamin Bentmann (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MDEP-122?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_125745 ] 

Benjamin Bentmann commented on MDEP-122:
----------------------------------------

Instead of {{<ignoredDependencies>}}, I suggest to use {{<usedDependencies>}} to tell the plugin the actual meaning of the dependency. This allows the plugin to correctly create the analysis right from the beginning instead of post-processing the initial analysis. For example, this also allows to detect the case of an used but undeclared dependency as sketched below:
{noformat}
project                 uses constant C from dep-b, hence dep-b should be a declared dependency
+- dep-a:compile
   +- dep-b:compile     defines some constant C
{noformat}

> Analyze target does not work correctly when only using a constant defined in a different module
> -----------------------------------------------------------------------------------------------
>
>                 Key: MDEP-122
>                 URL: http://jira.codehaus.org/browse/MDEP-122
>             Project: Maven 2.x Dependency Plugin
>          Issue Type: Bug
>    Affects Versions: 2.0-alpha-4
>         Environment: Windows.
> Maven 2.0.6
> Java 1.5 compiler
>            Reporter: Iker Almandoz
>            Assignee: Brian Fox
>            Priority: Minor
>         Attachments: analyze.zip, maven_bug.zip
>
>
> I have 2 projects as seen in the attached files.
> My first project contains a single interface that defines a String constant.
> My second project, uses the String constant from my first project.
> When i try to use dependency:analyze to fail the build as seen below, i can't make the system work.
> If i add the dependency from project 2 to project 1, i get:
> [INFO] [dependency:analyze {execution: analyze}]
> [INFO] Used declared dependencies:
> [INFO]    None
> [INFO] Used undeclared dependencies:
> [WARNING]    None
> [INFO] Unused declared dependencies:
> [INFO]    test:project1:jar: 1.0-SNAPSHOT:compile
> [WARNING] Potential problems discovered.
> But if i remove it, i get:
> If i remove the supposedly unused dependency, then I get a compile error:
> [INFO] ------------------------------------------------------------------------
> [ERROR] BUILD FAILURE
> [INFO] ------------------------------------------------------------------------
> [INFO] Compilation failure
> C:\ASSIA\development\maven_bug\project2\src\main\java\project2\NamesUser.java:[6
> ,24] package project1 does not exist
> Here is the build definition i have...
>     <build>
>     <plugins>
>      <plugin>
>         <groupId>org.apache.maven.plugins</groupId>
>         <artifactId>maven-dependency-plugin</artifactId>
>         <executions>
>           <execution>
>             <id>analyze</id>
>             <phase>package</phase>
>             <goals>
>               <goal>analyze</goal>
>             </goals>
>             <configuration>
>                 <failBuild>true</failBuild>
>                 <ignoreDirect>false</ignoreDirect>
>             </configuration>
>           </execution>
>         </executions>
>       </plugin>
>     </plugins>
>   </build>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (MDEP-122) Analyze target does not work correctly when only using a constant defined in a different module

Posted by "Iker Almandoz (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MDEP-122?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_122237 ] 

Iker Almandoz commented on MDEP-122:
------------------------------------

Would it be possible to add an option to the dependency plugin to allow some dependencies to be ignored when using the 'analyze' target to 'failBuild' ?
Something like:
<configuration>
 <ignoreDependencies>
    <dependency>
      <groupId>test</groupId>
      <artifactId>project1</artifactId>
     <version>1.0-SNAPSHOT</version>
   </dependency>
...
Such that the 'failBuild' ignores those dependencies when checking for the 'failure' ?
This feature is important for our company in order to have all modules check that only the necessary dependencies are being imported. 




> Analyze target does not work correctly when only using a constant defined in a different module
> -----------------------------------------------------------------------------------------------
>
>                 Key: MDEP-122
>                 URL: http://jira.codehaus.org/browse/MDEP-122
>             Project: Maven 2.x Dependency Plugin
>          Issue Type: Bug
>    Affects Versions: 2.0-alpha-4
>         Environment: Windows.
> Maven 2.0.6
> Java 1.5 compiler
>            Reporter: Iker Almandoz
>            Assignee: Brian Fox
>            Priority: Minor
>         Attachments: analyze.zip, maven_bug.zip
>
>
> I have 2 projects as seen in the attached files.
> My first project contains a single interface that defines a String constant.
> My second project, uses the String constant from my first project.
> When i try to use dependency:analyze to fail the build as seen below, i can't make the system work.
> If i add the dependency from project 2 to project 1, i get:
> [INFO] [dependency:analyze {execution: analyze}]
> [INFO] Used declared dependencies:
> [INFO]    None
> [INFO] Used undeclared dependencies:
> [WARNING]    None
> [INFO] Unused declared dependencies:
> [INFO]    test:project1:jar: 1.0-SNAPSHOT:compile
> [WARNING] Potential problems discovered.
> But if i remove it, i get:
> If i remove the supposedly unused dependency, then I get a compile error:
> [INFO] ------------------------------------------------------------------------
> [ERROR] BUILD FAILURE
> [INFO] ------------------------------------------------------------------------
> [INFO] Compilation failure
> C:\ASSIA\development\maven_bug\project2\src\main\java\project2\NamesUser.java:[6
> ,24] package project1 does not exist
> Here is the build definition i have...
>     <build>
>     <plugins>
>      <plugin>
>         <groupId>org.apache.maven.plugins</groupId>
>         <artifactId>maven-dependency-plugin</artifactId>
>         <executions>
>           <execution>
>             <id>analyze</id>
>             <phase>package</phase>
>             <goals>
>               <goal>analyze</goal>
>             </goals>
>             <configuration>
>                 <failBuild>true</failBuild>
>                 <ignoreDirect>false</ignoreDirect>
>             </configuration>
>           </execution>
>         </executions>
>       </plugin>
>     </plugins>
>   </build>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] (MDEP-122) Analyze target does not work correctly when only using a constant defined in a different module

Posted by "Herve Boutemy (JIRA)" <ji...@codehaus.org>.
     [ https://jira.codehaus.org/browse/MDEP-122?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Herve Boutemy updated MDEP-122:
-------------------------------

    Description: 
I have 2 projects as seen in the attached files.
My first project contains a single interface that defines a String constant.
My second project, uses the String constant from my first project.

When i try to use dependency:analyze to fail the build as seen below, i can't make the system work.

If i add the dependency from project 2 to project 1, i get:
{noformat}[INFO] [dependency:analyze {execution: analyze}]
[INFO] Used declared dependencies:
[INFO]    None
[INFO] Used undeclared dependencies:
[WARNING]    None
[INFO] Unused declared dependencies:
[INFO]    test:project1:jar: 1.0-SNAPSHOT:compile
[WARNING] Potential problems discovered.{noformat}


But if i remove it, i get:
If i remove the supposedly unused dependency, then I get a compile error:
{noformat}[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Compilation failure
C:\ASSIA\development\maven_bug\project2\src\main\java\project2\NamesUser.java:[6,24] package project1 does not exist{noformat}


Here is the build definition i have...
{code:xml}    <build>
    <plugins>
     <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>analyze</id>
            <phase>package</phase>
            <goals>
              <goal>analyze</goal>
            </goals>
            <configuration>
                <failBuild>true</failBuild>
                <ignoreDirect>false</ignoreDirect>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>{code}

  was:
I have 2 projects as seen in the attached files.
My first project contains a single interface that defines a String constant.
My second project, uses the String constant from my first project.

When i try to use dependency:analyze to fail the build as seen below, i can't make the system work.

If i add the dependency from project 2 to project 1, i get:
{noformat}[INFO] [dependency:analyze {execution: analyze}]
[INFO] Used declared dependencies:
[INFO]    None
[INFO] Used undeclared dependencies:
[WARNING]    None
[INFO] Unused declared dependencies:
[INFO]    test:project1:jar: 1.0-SNAPSHOT:compile
[WARNING] Potential problems discovered.{noformat}


But if i remove it, i get:
If i remove the supposedly unused dependency, then I get a compile error:
{noformat}[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Compilation failure
C:\ASSIA\development\maven_bug\project2\src\main\java\project2\NamesUser.java:[6
,24] package project1 does not exist{noformat}


Here is the build definition i have...
{code:xml}    <build>
    <plugins>
     <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>analyze</id>
            <phase>package</phase>
            <goals>
              <goal>analyze</goal>
            </goals>
            <configuration>
                <failBuild>true</failBuild>
                <ignoreDirect>false</ignoreDirect>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>{code}

    
> Analyze target does not work correctly when only using a constant defined in a different module
> -----------------------------------------------------------------------------------------------
>
>                 Key: MDEP-122
>                 URL: https://jira.codehaus.org/browse/MDEP-122
>             Project: Maven 2.x Dependency Plugin
>          Issue Type: Bug
>          Components: analyze
>    Affects Versions: 2.0-alpha-4
>         Environment: Windows.
> Maven 2.0.6
> Java 1.5 compiler
>            Reporter: Iker Almandoz
>            Assignee: Herve Boutemy
>            Priority: Minor
>             Fix For: 2.6
>
>         Attachments: analyze.zip, maven_bug.zip
>
>
> I have 2 projects as seen in the attached files.
> My first project contains a single interface that defines a String constant.
> My second project, uses the String constant from my first project.
> When i try to use dependency:analyze to fail the build as seen below, i can't make the system work.
> If i add the dependency from project 2 to project 1, i get:
> {noformat}[INFO] [dependency:analyze {execution: analyze}]
> [INFO] Used declared dependencies:
> [INFO]    None
> [INFO] Used undeclared dependencies:
> [WARNING]    None
> [INFO] Unused declared dependencies:
> [INFO]    test:project1:jar: 1.0-SNAPSHOT:compile
> [WARNING] Potential problems discovered.{noformat}
> But if i remove it, i get:
> If i remove the supposedly unused dependency, then I get a compile error:
> {noformat}[INFO] ------------------------------------------------------------------------
> [ERROR] BUILD FAILURE
> [INFO] ------------------------------------------------------------------------
> [INFO] Compilation failure
> C:\ASSIA\development\maven_bug\project2\src\main\java\project2\NamesUser.java:[6,24] package project1 does not exist{noformat}
> Here is the build definition i have...
> {code:xml}    <build>
>     <plugins>
>      <plugin>
>         <groupId>org.apache.maven.plugins</groupId>
>         <artifactId>maven-dependency-plugin</artifactId>
>         <executions>
>           <execution>
>             <id>analyze</id>
>             <phase>package</phase>
>             <goals>
>               <goal>analyze</goal>
>             </goals>
>             <configuration>
>                 <failBuild>true</failBuild>
>                 <ignoreDirect>false</ignoreDirect>
>             </configuration>
>           </execution>
>         </executions>
>       </plugin>
>     </plugins>
>   </build>{code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] (MDEP-122) Analyze target does not work correctly when only using a constant defined in a different module

Posted by "Mark Michaelis (JIRA)" <ji...@codehaus.org>.
    [ https://jira.codehaus.org/browse/MDEP-122?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=298909#comment-298909 ] 

Mark Michaelis commented on MDEP-122:
-------------------------------------

For now I am using a workaround for this issue: I use the classes once in my code. For example with such a (most of the time) hidden log-statement (here: slf4j):
{code:java}
// Workaround for MDEP-122: Use class once.
LOG.trace("Using constants from {}.", ConstantsClass.class.getName());
{code}
                
> Analyze target does not work correctly when only using a constant defined in a different module
> -----------------------------------------------------------------------------------------------
>
>                 Key: MDEP-122
>                 URL: https://jira.codehaus.org/browse/MDEP-122
>             Project: Maven 2.x Dependency Plugin
>          Issue Type: Bug
>    Affects Versions: 2.0-alpha-4
>         Environment: Windows.
> Maven 2.0.6
> Java 1.5 compiler
>            Reporter: Iker Almandoz
>            Assignee: Brian Fox
>            Priority: Minor
>         Attachments: analyze.zip, maven_bug.zip
>
>
> I have 2 projects as seen in the attached files.
> My first project contains a single interface that defines a String constant.
> My second project, uses the String constant from my first project.
> When i try to use dependency:analyze to fail the build as seen below, i can't make the system work.
> If i add the dependency from project 2 to project 1, i get:
> [INFO] [dependency:analyze {execution: analyze}]
> [INFO] Used declared dependencies:
> [INFO]    None
> [INFO] Used undeclared dependencies:
> [WARNING]    None
> [INFO] Unused declared dependencies:
> [INFO]    test:project1:jar: 1.0-SNAPSHOT:compile
> [WARNING] Potential problems discovered.
> But if i remove it, i get:
> If i remove the supposedly unused dependency, then I get a compile error:
> [INFO] ------------------------------------------------------------------------
> [ERROR] BUILD FAILURE
> [INFO] ------------------------------------------------------------------------
> [INFO] Compilation failure
> C:\ASSIA\development\maven_bug\project2\src\main\java\project2\NamesUser.java:[6
> ,24] package project1 does not exist
> Here is the build definition i have...
>     <build>
>     <plugins>
>      <plugin>
>         <groupId>org.apache.maven.plugins</groupId>
>         <artifactId>maven-dependency-plugin</artifactId>
>         <executions>
>           <execution>
>             <id>analyze</id>
>             <phase>package</phase>
>             <goals>
>               <goal>analyze</goal>
>             </goals>
>             <configuration>
>                 <failBuild>true</failBuild>
>                 <ignoreDirect>false</ignoreDirect>
>             </configuration>
>           </execution>
>         </executions>
>       </plugin>
>     </plugins>
>   </build>

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (MDEP-122) Analyze target does not work correctly when only using a constant defined in a different module

Posted by "Brian Fox (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MDEP-122?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_122241 ] 

Brian Fox commented on MDEP-122:
--------------------------------

Yes, this sounds like a reasonable work around.

> Analyze target does not work correctly when only using a constant defined in a different module
> -----------------------------------------------------------------------------------------------
>
>                 Key: MDEP-122
>                 URL: http://jira.codehaus.org/browse/MDEP-122
>             Project: Maven 2.x Dependency Plugin
>          Issue Type: Bug
>    Affects Versions: 2.0-alpha-4
>         Environment: Windows.
> Maven 2.0.6
> Java 1.5 compiler
>            Reporter: Iker Almandoz
>            Assignee: Brian Fox
>            Priority: Minor
>         Attachments: analyze.zip, maven_bug.zip
>
>
> I have 2 projects as seen in the attached files.
> My first project contains a single interface that defines a String constant.
> My second project, uses the String constant from my first project.
> When i try to use dependency:analyze to fail the build as seen below, i can't make the system work.
> If i add the dependency from project 2 to project 1, i get:
> [INFO] [dependency:analyze {execution: analyze}]
> [INFO] Used declared dependencies:
> [INFO]    None
> [INFO] Used undeclared dependencies:
> [WARNING]    None
> [INFO] Unused declared dependencies:
> [INFO]    test:project1:jar: 1.0-SNAPSHOT:compile
> [WARNING] Potential problems discovered.
> But if i remove it, i get:
> If i remove the supposedly unused dependency, then I get a compile error:
> [INFO] ------------------------------------------------------------------------
> [ERROR] BUILD FAILURE
> [INFO] ------------------------------------------------------------------------
> [INFO] Compilation failure
> C:\ASSIA\development\maven_bug\project2\src\main\java\project2\NamesUser.java:[6
> ,24] package project1 does not exist
> Here is the build definition i have...
>     <build>
>     <plugins>
>      <plugin>
>         <groupId>org.apache.maven.plugins</groupId>
>         <artifactId>maven-dependency-plugin</artifactId>
>         <executions>
>           <execution>
>             <id>analyze</id>
>             <phase>package</phase>
>             <goals>
>               <goal>analyze</goal>
>             </goals>
>             <configuration>
>                 <failBuild>true</failBuild>
>                 <ignoreDirect>false</ignoreDirect>
>             </configuration>
>           </execution>
>         </executions>
>       </plugin>
>     </plugins>
>   </build>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (MDEP-122) Analyze target does not work correctly when only using a constant defined in a different module

Posted by "Benjamin Bentmann (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MDEP-122?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_122167 ] 

Benjamin Bentmann commented on MDEP-122:
----------------------------------------

As stated in [Clarifications and Amendments to the JLS, Class Initialization|http://java.sun.com/docs/books/jls/clarify.html], a Java compiler must replace any references to a compile-time constant with a copy of its value. Hence, an analysis of the mere bytecode as done by the plugin via ASM cannot detect such dependencies.

> Analyze target does not work correctly when only using a constant defined in a different module
> -----------------------------------------------------------------------------------------------
>
>                 Key: MDEP-122
>                 URL: http://jira.codehaus.org/browse/MDEP-122
>             Project: Maven 2.x Dependency Plugin
>          Issue Type: Bug
>    Affects Versions: 2.0-alpha-4
>         Environment: Windows.
> Maven 2.0.6
> Java 1.5 compiler
>            Reporter: Iker Almandoz
>            Assignee: Brian Fox
>            Priority: Minor
>         Attachments: analyze.zip, maven_bug.zip
>
>
> I have 2 projects as seen in the attached files.
> My first project contains a single interface that defines a String constant.
> My second project, uses the String constant from my first project.
> When i try to use dependency:analyze to fail the build as seen below, i can't make the system work.
> If i add the dependency from project 2 to project 1, i get:
> [INFO] [dependency:analyze {execution: analyze}]
> [INFO] Used declared dependencies:
> [INFO]    None
> [INFO] Used undeclared dependencies:
> [WARNING]    None
> [INFO] Unused declared dependencies:
> [INFO]    test:project1:jar: 1.0-SNAPSHOT:compile
> [WARNING] Potential problems discovered.
> But if i remove it, i get:
> If i remove the supposedly unused dependency, then I get a compile error:
> [INFO] ------------------------------------------------------------------------
> [ERROR] BUILD FAILURE
> [INFO] ------------------------------------------------------------------------
> [INFO] Compilation failure
> C:\ASSIA\development\maven_bug\project2\src\main\java\project2\NamesUser.java:[6
> ,24] package project1 does not exist
> Here is the build definition i have...
>     <build>
>     <plugins>
>      <plugin>
>         <groupId>org.apache.maven.plugins</groupId>
>         <artifactId>maven-dependency-plugin</artifactId>
>         <executions>
>           <execution>
>             <id>analyze</id>
>             <phase>package</phase>
>             <goals>
>               <goal>analyze</goal>
>             </goals>
>             <configuration>
>                 <failBuild>true</failBuild>
>                 <ignoreDirect>false</ignoreDirect>
>             </configuration>
>           </execution>
>         </executions>
>       </plugin>
>     </plugins>
>   </build>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira