You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Thomas Chang <th...@yahoo.de> on 2008/01/02 14:19:41 UTC

Problem by injecting POM Properties via Settings.xml

Hi all,
   
  According to the link http://maven.apache.org/examples/injecting-properties-via-settings.html I do in my "pom.xml" and "settings.xml" followings:
   
  in the "pom.xml":
  =============
  ...
  <dependency>
  <groupId>junit</groupId>
  <artifactId>junit</artifactId>
  <version>${myversion}</version>
  </dependency>
  ...
   
  in the "settings.xml":
  ===============
  ...
  <profiles>
  <profile>
  <properties>
  <myversion>3.8.1</myversion>
  </properties>
  </profile>
  </profiles>
  ...
   
  But a sI run "mvn eclipse:eclipse" I get error as follow. Somebody can help?
  ...
  Downloading: file:////sap-dev/CVSREPO/CvsMaven/junit/junit/${myversion}/junit-${
myversion}.jar
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.
  Missing:
----------
1) junit:junit:jar:${myversion}
    Try downloading the file manually from the project website.
    Then, install it using the command:
      mvn install:install-file -DgroupId=junit -DartifactId=junit \
          -Dversion=${myversion} -Dpackaging=jar -Dfile=/path/to/file
Alternatively, if you host your own repository you can deploy the file there:
    mvn deploy:deploy-file -DgroupId=junit -DartifactId=junit \
          -Dversion=${myversion} -Dpackaging=jar -Dfile=/path/to/file \
           -Durl=[url] -DrepositoryId=[id]
    Path to dependency:
        1) com.wei.chen.app:TestXml:jar:1.0-SNAPSHOT
        2) junit:junit:jar:${myversion}
  ----------
1 required artifact is missing.
  for artifact:
  com.wei.chen.app:TestXml:jar:1.0-SNAPSHOT
  from the specified remote repositories:
  central (http://repo1.maven.org/maven2)
  
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 second
[INFO] Finished at: Wed Jan 02 14:18:48 CET 2008
[INFO] Final Memory: 2M/5M
[INFO] ------------------------------------------------------------------------
  E:\Projekte\TestXml>
  ...
   

       
---------------------------------
Ihr erstes Fernweh? Wo gibt es den schönsten Strand. 

Re: Problem by injecting POM Properties via Settings.xml

Posted by Olivier Lamy <ol...@apache.org>.
Hi,
The profile in your settings need to be active.
Try with :

>   <profiles>
>   <profile>
     <id>normal</id>
     <activation>
     	<activeByDefault>true</activeByDefault>
     </activation>
>   <properties>
>   <myversion>3.8.1</myversion>
>   </properties>
>   </profile>
>   </profiles>

Use mvn help:effective-pom to see the pom interpolated.

--
Olivier

2008/1/2, Thomas Chang <th...@yahoo.de>:
> Hi all,
>
>   According to the link http://maven.apache.org/examples/injecting-properties-via-settings.html I do in my "pom.xml" and "settings.xml" followings:
>
>   in the "pom.xml":
>   =============
>   ...
>   <dependency>
>   <groupId>junit</groupId>
>   <artifactId>junit</artifactId>
>   <version>${myversion}</version>
>   </dependency>
>   ...
>
>   in the "settings.xml":
>   ===============
>   ...
>   <profiles>
>   <profile>
>   <properties>
>   <myversion>3.8.1</myversion>
>   </properties>
>   </profile>
>   </profiles>
>   ...
>
>   But a sI run "mvn eclipse:eclipse" I get error as follow. Somebody can help?
>   ...
>   Downloading: file:////sap-dev/CVSREPO/CvsMaven/junit/junit/${myversion}/junit-${
> myversion}.jar
> [INFO] ------------------------------------------------------------------------
> [ERROR] BUILD ERROR
> [INFO] ------------------------------------------------------------------------
> [INFO] Failed to resolve artifact.
>   Missing:
> ----------
> 1) junit:junit:jar:${myversion}
>     Try downloading the file manually from the project website.
>     Then, install it using the command:
>       mvn install:install-file -DgroupId=junit -DartifactId=junit \
>           -Dversion=${myversion} -Dpackaging=jar -Dfile=/path/to/file
> Alternatively, if you host your own repository you can deploy the file there:
>     mvn deploy:deploy-file -DgroupId=junit -DartifactId=junit \
>           -Dversion=${myversion} -Dpackaging=jar -Dfile=/path/to/file \
>            -Durl=[url] -DrepositoryId=[id]
>     Path to dependency:
>         1) com.wei.chen.app:TestXml:jar:1.0-SNAPSHOT
>         2) junit:junit:jar:${myversion}
>   ----------
> 1 required artifact is missing.
>   for artifact:
>   com.wei.chen.app:TestXml:jar:1.0-SNAPSHOT
>   from the specified remote repositories:
>   central (http://repo1.maven.org/maven2)
>
> [INFO] ------------------------------------------------------------------------
> [INFO] For more information, run Maven with the -e switch
> [INFO] ------------------------------------------------------------------------
> [INFO] Total time: 1 second
> [INFO] Finished at: Wed Jan 02 14:18:48 CET 2008
> [INFO] Final Memory: 2M/5M
> [INFO] ------------------------------------------------------------------------
>   E:\Projekte\TestXml>
>   ...
>
>
>
> ---------------------------------
> Ihr erstes Fernweh? Wo gibt es den schönsten Strand.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org