[ 
https://issues.apache.org/jira/browse/KARAF-3429?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16095978#comment-16095978
 ] 

Grzegorz Grzybek edited comment on KARAF-3429 at 7/21/17 8:55 AM:
------------------------------------------------------------------

Here's how it works with Karaf 4.2.0.

* I started with clean {{apache-karaf-minimal-4.2.0-SNAPSHOT.zip}}
* I unzipped and started using {{bin/karaf}}
* I installed new {{maven}} feature: {{feature:install maven}} (no proxy used 
yet - I want to show you new command) - see 
[documentation|https://github.com/apache/karaf/blob/master-maven-commands/manual/src/main/asciidoc/user-guide/urls.adoc#maven-configuration-commands]
* Now see these commands:
{noformat}
karaf@root()> maven:summary

Option                    │ Value
──────────────────────────┼─────────────────────────────────────────────────────────────────
Local repository          │ /home/ggrzybek/.m2/repository
Settings file             │ /home/ggrzybek/.m2/settings.xml
Security settings file    │ /home/ggrzybek/.m2/settings-security.xml
...

karaf@root()> maven:http-proxy-list

No HTTP proxies configured in /home/ggrzybek/.m2/settings.xml
{noformat}

* I have squid running, so I add new http proxy:
{noformat}
karaf@root()> http-proxy --add -id squid -u admin -p admin localhost:3128       
                                                                                
                                                                       10:51:10
New settings stored in 
"/data/servers/apache-karaf-minimal-4.2.0-SNAPSHOT/data/cache/bundle36/data/maven-settings-1500627078664.xml"

ID    │ Host      │ Port │ Non-proxy hosts │ Username
──────┼───────────┼──────┼─────────────────┼─────────
squid │ localhost │ 3128 │                 │ admin
{noformat}

* I created {{${karaf.home}/data/repository}} directory and changed 
localRepository configuration, so I'm sure my normal {{~/.m2/repository}} won't 
affect the test:
{noformat}
karaf@root()> config:property-set --pid org.ops4j.pax.url.mvn 
org.ops4j.pax.url.mvn.localRepository ${karaf.data}/repository                  
                                                                                
         10:51:18
karaf@root()> maven:summary|grep Local                                          
                                                                                
                                                                       10:52:56
Local repository          │ 
/data/servers/apache-karaf-minimal-4.2.0-SNAPSHOT/data/repository
{noformat}

* just quick look at 
{{/data/servers/apache-karaf-minimal-4.2.0-SNAPSHOT/data/cache/bundle36/data/maven-settings-1500627078664.xml}}:
{code:xml}
...
  <proxies>
    <proxy>
      <username>admin</username>
      <password>admin</password>
      <port>3128</port>
      <host>localhost</host>
      <id>squid</id>
    </proxy>
  </proxies>
...
{code}

* now, let's install some feature:
{noformat}
karaf@root()> feature:install war                                               
                                                                                
                                                                       10:53:08
{noformat}

* squid starts logging:
{noformat}
1500627261.005    291 127.0.0.1 TCP_CLIENT_REFRESH_MISS/200 1238 GET 
http://repository.apache.org/content/groups/snapshots-group/org/apache/karaf/web/org.apache.karaf.web.core/4.2.0-SNAPSHOT/maven-metadata.xml
 admin HIER_DIRECT/207.244.88.140 application/xml
1500627261.307    292 127.0.0.1 TCP_CLIENT_REFRESH_MISS/200 544 GET 
http://repository.apache.org/content/groups/snapshots-group/org/apache/karaf/web/org.apache.karaf.web.core/4.2.0-SNAPSHOT/maven-metadata.xml.sha1
 admin HIER_DIRECT/207.244.88.140 application/octet-stream
1500627263.817   3102 127.0.0.1 TCP_MISS/200 6603 CONNECT oss.sonatype.org:443 
admin HIER_DIRECT/52.22.249.229 -
1500627263.909   3194 127.0.0.1 TCP_MISS/200 6567 CONNECT oss.sonatype.org:443 
admin HIER_DIRECT/52.22.249.229 -
1500627264.344    429 127.0.0.1 TCP_CLIENT_REFRESH_MISS/200 35389 GET 
http://repository.apache.org/content/groups/snapshots-group/org/apache/karaf/web/org.apache.karaf.web.core/4.2.0-SNAPSHOT/org.apache.karaf.web.core-4.2.0-20170721.031310-180.jar
 admin HIER_DIRECT/207.244.88.140 application/java-archive
1500627264.635    287 127.0.0.1 TCP_CLIENT_REFRESH_MISS/200 543 GET 
http://repository.apache.org/content/groups/snapshots-group/org/apache/karaf/web/org.apache.karaf.web.core/4.2.0-SNAPSHOT/org.apache.karaf.web.core-4.2.0-20170721.031310-180.jar.sha1
 admin HIER_DIRECT/207.244.88.140 application/octet-stream
{noformat}

* finally, 
{{/data/servers/apache-karaf-minimal-4.2.0-SNAPSHOT/data/repository}} is full 
of new artifacts


was (Author: gzres):
Here's how it works with Karaf 4.2.0.

* I started with clean {{apache-karaf-minimal-4.2.0-SNAPSHOT.zip}}
* I unzipped and started using {{bin/karaf}}
* I installed new {{maven}} feature: {{feature:install maven}} (no proxy used 
yet - I want to show you new command) - see 
[documentation|https://github.com/apache/karaf/blob/master-maven-commands/manual/src/main/asciidoc/user-guide/urls.adoc#maven-configuration-commands]
* Now see these commands:
{noformat}
karaf@root()> maven:summary

Option                    │ Value
──────────────────────────┼─────────────────────────────────────────────────────────────────
Local repository          │ /home/ggrzybek/.m2/repository
Settings file             │ /home/ggrzybek/.m2/settings.xml
Security settings file    │ /home/ggrzybek/.m2/settings-security.xml
...

karaf@root()> maven:http-proxy-list

No HTTP proxies configured in /home/ggrzybek/.m2/settings.xml
{noformat}

* I have squid running, so I add new http proxy:
{noformat}
karaf@root()> http-proxy --add -id squid -u admin -p admin localhost:3128       
                                                                                
                                                                       10:51:10
New settings stored in 
"/data/servers/apache-karaf-minimal-4.2.0-SNAPSHOT/data/cache/bundle36/data/maven-settings-1500627078664.xml"

ID    │ Host      │ Port │ Non-proxy hosts │ Username
──────┼───────────┼──────┼─────────────────┼─────────
squid │ localhost │ 3128 │                 │ admin
{noformat}

* I created {{$&#123;karaf.home&#125;/data/repository}} directory and changed 
localRepository configuration, so I'm sure my normal {{~/.m2/repository}} won't 
affect the test:
{noformat}
karaf@root()> config:property-set --pid org.ops4j.pax.url.mvn 
org.ops4j.pax.url.mvn.localRepository ${karaf.data}/repository                  
                                                                                
         10:51:18
karaf@root()> maven:summary|grep Local                                          
                                                                                
                                                                       10:52:56
Local repository          │ 
/data/servers/apache-karaf-minimal-4.2.0-SNAPSHOT/data/repository
{noformat}

* just quick look at 
{{/data/servers/apache-karaf-minimal-4.2.0-SNAPSHOT/data/cache/bundle36/data/maven-settings-1500627078664.xml}}:
{code:xml}
...
  <proxies>
    <proxy>
      <username>admin</username>
      <password>admin</password>
      <port>3128</port>
      <host>localhost</host>
      <id>squid</id>
    </proxy>
  </proxies>
...
{code}

* now, let's install some feature:
{noformat}
karaf@root()> feature:install war                                               
                                                                                
                                                                       10:53:08
{noformat}

* squid starts logging:
{noformat}
1500627261.005    291 127.0.0.1 TCP_CLIENT_REFRESH_MISS/200 1238 GET 
http://repository.apache.org/content/groups/snapshots-group/org/apache/karaf/web/org.apache.karaf.web.core/4.2.0-SNAPSHOT/maven-metadata.xml
 admin HIER_DIRECT/207.244.88.140 application/xml
1500627261.307    292 127.0.0.1 TCP_CLIENT_REFRESH_MISS/200 544 GET 
http://repository.apache.org/content/groups/snapshots-group/org/apache/karaf/web/org.apache.karaf.web.core/4.2.0-SNAPSHOT/maven-metadata.xml.sha1
 admin HIER_DIRECT/207.244.88.140 application/octet-stream
1500627263.817   3102 127.0.0.1 TCP_MISS/200 6603 CONNECT oss.sonatype.org:443 
admin HIER_DIRECT/52.22.249.229 -
1500627263.909   3194 127.0.0.1 TCP_MISS/200 6567 CONNECT oss.sonatype.org:443 
admin HIER_DIRECT/52.22.249.229 -
1500627264.344    429 127.0.0.1 TCP_CLIENT_REFRESH_MISS/200 35389 GET 
http://repository.apache.org/content/groups/snapshots-group/org/apache/karaf/web/org.apache.karaf.web.core/4.2.0-SNAPSHOT/org.apache.karaf.web.core-4.2.0-20170721.031310-180.jar
 admin HIER_DIRECT/207.244.88.140 application/java-archive
1500627264.635    287 127.0.0.1 TCP_CLIENT_REFRESH_MISS/200 543 GET 
http://repository.apache.org/content/groups/snapshots-group/org/apache/karaf/web/org.apache.karaf.web.core/4.2.0-SNAPSHOT/org.apache.karaf.web.core-4.2.0-20170721.031310-180.jar.sha1
 admin HIER_DIRECT/207.244.88.140 application/octet-stream
{noformat}


> always use proxy server listed in maven settings.xml when installing features
> -----------------------------------------------------------------------------
>
>                 Key: KARAF-3429
>                 URL: https://issues.apache.org/jira/browse/KARAF-3429
>             Project: Karaf
>          Issue Type: Bug
>          Components: karaf-feature
>         Environment: windows 7, karaf-4.0.0M1
>            Reporter: Christian Gann
>            Assignee: Grzegorz Grzybek
>             Fix For: 4.2.0
>
>
> when I run feature:install obr in karaf shell, the exceptions would be 
> reported in karaf.log:
> connect timeout, use proxy server to download jars.
> the proxy server in ~/.m2/settings.xml, and I have set the active is false, 
> but karaf still use the setting when installing features. I have to comment 
> the line out, and it works.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to