[ 
https://jira.codehaus.org/browse/MNG-5082?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Robert Scholte updated MNG-5082:
--------------------------------

    Component/s: Dependencies
    Description: 
Sometimes, when you need a jar, which is not available from a repository, and 
for some reason you don't want to deploy it to the corporate repository (yet), 
you can do something like this:

{code:xml}
         <build>
                <plugins>
                        ...
                        <plugin>
                                <artifactId>maven-install-plugin</artifactId>
                                <executions>
                                        <execution>
                                                <id>some-lib</id>
                                                <phase>validate</phase>
                                                <goals>
                                                        
<goal>install-file</goal>
                                                </goals>
                                                <configuration>
                                                        
<file>lib/some-lib-1.1.jar</file>
                                                        
<groupId>org.someorg.somelib</groupId>
                                                        
<artifactId>some-lib</artifactId>
                                                        <version>1.1</version>
                                                        
<packaging>jar</packaging>
                                                </configuration>
                                        </execution>
                                </executions>
                        </plugin>
                        ...
                </plugins>
        </build>
{code}

And then you can declare a dependency on this lib like this:
{code:xml}
         <dependencies>
                ...
                <dependency>
                        <groupId>org.someorg.somelib</groupId>
                        <artifactId>some-lib</artifactId>
                        <version>1.1</version>
                </dependency>
                ...
        </dependencies>
{code}
This worked fine with {{Maven 2.2.1}} but not with {{Maven 3.0.3}} -> 
regression!

{noformat}
Error message:
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.951s
[INFO] Finished at: Thu Apr 28 15:53:15 BST 2011
[INFO] Final Memory: 4M/121M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project myproject: Could not resolve 
dependencies for project someGroupId:someArtifactId:jar:0.1-SNAPSHOT: Could not 
find artifact org.someorg.somelib:some-lib:jar:1.1 in nexus (<nexus url>) -> 
[Help 1]
[ERROR] 
{noformat}

There is a work-around, which at least works in some cases:
{noformat}
mvn clean validate
mvn install
{noformat}

Some notes on this work-around:
- install should call validate (which it does, but apparently with some 
side-effects). It should not be necessary to call validate explicitly.
- "mvn clean validate install" does not work! It shouldn't matter if you call 
"mvn clean validate install" or "mvn clean validate" and "mvn install". Both 
should have the same result.
- I currently don't see a way to specify in Jenkins/ Hudson to first execute 
"clean validate" and then "install" -> broken build on continuous integration 
server which has to be fixed manually
- This work-around breaks the Maven way, because you cannot simply go to a 
project anymore and just call "mvn clean install" to build it.


  was:
Sometimes, when you need a jar, which is not available from a repository, and 
for some reason you don't want to deploy it to the corporate repository (yet), 
you can do something like this:

         <build>
                <plugins>
                        ...
                        <plugin>
                                <artifactId>maven-install-plugin</artifactId>
                                <executions>
                                        <execution>
                                                <id>some-lib</id>
                                                <phase>validate</phase>
                                                <goals>
                                                        
<goal>install-file</goal>
                                                </goals>
                                                <configuration>
                                                        
<file>lib/some-lib-1.1.jar</file>
                                                        
<groupId>org.someorg.somelib</groupId>
                                                        
<artifactId>some-lib</artifactId>
                                                        <version>1.1</version>
                                                        
<packaging>jar</packaging>
                                                </configuration>
                                        </execution>
                                </executions>
                        </plugin>
                        ...
                </plugins>
        </build>

And then you can declare a dependency on this lib like this:

         <dependencies>
                ...
                <dependency>
                        <groupId>org.someorg.somelib</groupId>
                        <artifactId>some-lib</artifactId>
                        <version>1.1</version>
                </dependency>
                ...
        </dependencies>

This worked fine with Maven 2.2.1 but not with Maven 3.0.3 -> regression!

Error message:
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.951s
[INFO] Finished at: Thu Apr 28 15:53:15 BST 2011
[INFO] Final Memory: 4M/121M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project myproject: Could not resolve 
dependencies for project someGroupId:someArtifactId:jar:0.1-SNAPSHOT: Could not 
find artifact org.someorg.somelib:some-lib:jar:1.1 in nexus (<nexus url>) -> 
[Help 1]
[ERROR] 

There is a work-around, which at least works in some cases:
mvn clean validate
mvn install

Some notes on this work-around:
- install should call validate (which it does, but apparently with some 
side-effects). It should not be necessary to call validate explicitly.
- "mvn clean validate install" does not work! It shouldn't matter if you call 
"mvn clean validate install" or "mvn clean validate" and "mvn install". Both 
should have the same result.
- I currently don't see a way to specify in Jenkins/ Hudson to first execute 
"clean validate" and then "install" -> broken build on continuous integration 
server which has to be fixed manually
- This work-around breaks the Maven way, because you cannot simply go to a 
project anymore and just call "mvn clean install" to build it.


    
> Regression: Could not resolve dependencies for project
> ------------------------------------------------------
>
>                 Key: MNG-5082
>                 URL: https://jira.codehaus.org/browse/MNG-5082
>             Project: Maven 2 & 3
>          Issue Type: Bug
>          Components: Dependencies
>    Affects Versions: 3.0.3
>            Reporter: Florian Brunner
>            Priority: Blocker
>
> Sometimes, when you need a jar, which is not available from a repository, and 
> for some reason you don't want to deploy it to the corporate repository 
> (yet), you can do something like this:
> {code:xml}
>          <build>
>               <plugins>
>                         ...
>                       <plugin>
>                               <artifactId>maven-install-plugin</artifactId>
>                               <executions>
>                                       <execution>
>                                               <id>some-lib</id>
>                                               <phase>validate</phase>
>                                               <goals>
>                                                       
> <goal>install-file</goal>
>                                               </goals>
>                                               <configuration>
>                                                       
> <file>lib/some-lib-1.1.jar</file>
>                                                       
> <groupId>org.someorg.somelib</groupId>
>                                                       
> <artifactId>some-lib</artifactId>
>                                                       <version>1.1</version>
>                                                       
> <packaging>jar</packaging>
>                                               </configuration>
>                                       </execution>
>                               </executions>
>                       </plugin>
>                       ...
>               </plugins>
>       </build>
> {code}
> And then you can declare a dependency on this lib like this:
> {code:xml}
>          <dependencies>
>                 ...
>               <dependency>
>                       <groupId>org.someorg.somelib</groupId>
>                       <artifactId>some-lib</artifactId>
>                       <version>1.1</version>
>               </dependency>
>               ...
>       </dependencies>
> {code}
> This worked fine with {{Maven 2.2.1}} but not with {{Maven 3.0.3}} -> 
> regression!
> {noformat}
> Error message:
> [INFO] BUILD FAILURE
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] Total time: 0.951s
> [INFO] Finished at: Thu Apr 28 15:53:15 BST 2011
> [INFO] Final Memory: 4M/121M
> [INFO] 
> ------------------------------------------------------------------------
> [ERROR] Failed to execute goal on project myproject: Could not resolve 
> dependencies for project someGroupId:someArtifactId:jar:0.1-SNAPSHOT: Could 
> not find artifact org.someorg.somelib:some-lib:jar:1.1 in nexus (<nexus url>) 
> -> [Help 1]
> [ERROR] 
> {noformat}
> There is a work-around, which at least works in some cases:
> {noformat}
> mvn clean validate
> mvn install
> {noformat}
> Some notes on this work-around:
> - install should call validate (which it does, but apparently with some 
> side-effects). It should not be necessary to call validate explicitly.
> - "mvn clean validate install" does not work! It shouldn't matter if you call 
> "mvn clean validate install" or "mvn clean validate" and "mvn install". Both 
> should have the same result.
> - I currently don't see a way to specify in Jenkins/ Hudson to first execute 
> "clean validate" and then "install" -> broken build on continuous integration 
> server which has to be fixed manually
> - This work-around breaks the Maven way, because you cannot simply go to a 
> project anymore and just call "mvn clean install" to build it.

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

Reply via email to