Maven http.authentication.preemptive against Artifactory - maven-3

I am having enormous difficulty downloading "protected" artifacts from my Artifactory server. Can anyone confirm that the (maven) settings.xml excerpt below is sufficient to cause GET requests to carry authentication info preemptively?
Maven 3.3.9. Artifactory 4.4.2.
<servers>
<server>
<id>myServerId</id>
<username>myUserId</username>
<password>myPlainTextPassword</password>
<configuration>
<httpConfiguration>
<all>
<params>
<property>
<name>http.authentication.preemptive</name>
<value>%b,true</value>
</property>
</params>
</all>
</httpConfiguration>
</configuration>
</server>
</servers>
Thanks,
Robin
Maven output:
C:\>mvn -U clean package
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building fc 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: http://repo.myserver.co.uk/artifactory/libs-release/com/group/artifact/126/artifact-126.pom
Downloading: http://www.license4j.com/maven/com/group/artifact/126/artifact-126.pom
Downloading: http://repo.myserver.co.uk/artifactory/private-local/com/group/artifact/126/artifact-126.pom
Downloading: https://repo.maven.apache.org/maven2/com/group/artifact/126/artifact-126.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.906 s
[INFO] Finished at: 2016-01-31T19:41:52+02:00
[INFO] Final Memory: 8M/245M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project fc: Could not resolve dependencies for project uk.co.myserver:fc:jar:1.0-SNAPSHOT: Failed to collect dependencies at com.group:artifact:jar:126: Failed to read artifact descriptor for com.group:artifact:jar:126: Could not transfer artifact com.group:artifact:pom:126 from/to releases (http://repo.myserver.co.uk/artifactory/libs-release): Access denied to: http://repo.myserver.co.uk/artifactory/libs-release/com/group/artifact/126/artifact-126.pom , ReasonPhrase:Forbidden. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
Artifactory Access Log:
2016-02-01 11:14:33,562 [DENIED DOWNLOAD] libs-release:com/group/artifact/126/artifact-126.pom for anonymous/193.66.174.253.
2016-02-01 11:14:33,564 [DENIED DOWNLOAD] private-release-local:com/group/artifact/126/artifact-126.pom for anonymous/193.66.174.253.
2016-02-01 11:14:34,436 [ACCEPTED DELETE] libs-release:com/group/artifact/126/artifact-126.pom for anonymous/193.66.174.253.
2016-02-01 11:14:35,010 [DENIED DOWNLOAD] private-local:com/group/artifact/126/artifact-126.pom for anonymous/193.66.174.253.
2016-02-01 11:14:35,011 [DENIED DOWNLOAD] private-release-local:com/group/artifact/126/artifact-126.pom for anonymous/193.66.174.253.
2016-02-01 11:14:35,012 [ACCEPTED DELETE] private-local:com/group/artifact/126/artifact-126.pom for anonymous/193.66.174.253.
All of the below exist identically in pom.xml and in settings.xml and, since they all reference the same Artifactory server, they share identical username/password/http.authentication.preemptive parameters :
<id>releases</id>
<id>snapshots</id>
<id>private-local</id>
<id>plugin-releases</id>
<id>plugin-snapshots</id>
<id>deploy-releases</id>
<id>deploy-snapshots</id>
Only the below is not mentioned in settings.xml, as access should be anonymous and it is a separate repository instance on someone else's server:
<id>license4j-runtime-library</id>
Here is the corresponding output from the request log:
20160202060102|58|REQUEST|193.66.174.253|admin|GET|/ui/systemlogs/logData|HTTP/1.1|200|0
20160202060102|1099|REQUEST|199.19.249.196|anonymous|GET|/libs-release/com/group/artifact/126/artifact-126.pom|HTTP/1.1|401|0
20160202060102|706|REQUEST|199.91.135.165|anonymous|GET|/libs-release/com/group/artifact/126/artifact-126.pom|HTTP/1.1|401|0
20160202060102|5|REQUEST|193.66.174.253|anonymous|GET|/libs-release/com/group/artifact/126/artifact-126.pom|HTTP/1.1|401|0
20160202060103|3|REQUEST|199.19.249.196|anonymous|GET|/private-local/com/group/artifact/126/artifact-126.pom|HTTP/1.1|401|0
20160202060103|3|REQUEST|193.66.174.253|anonymous|GET|/private-local/com/group/artifact/126/artifact-126.pom|HTTP/1.1|401|0
20160202060113|60|REQUEST|193.66.174.253|admin|GET|/ui/systemlogs/logData|HTTP/1.1|200|0
Note that there are two requests to private-local, both of which occur as "anonymous". With preemptive authentication I would have expected all of these to have been as "myUserId".

What are the permissions that you have for your anonymous user on Artifactory?
On Artifactory --> Admin --> Security --> General --> Is the checkbox for "Hide existence of unauthorised resources" is checked?
Other than that can you also paste the relevant part from the request.log?

When going behind a proxy the httpConfiguration for the server must be:
<server>
<id>**********</id>
<username>**********</username>
<password>**********</password>
<configuration>
<httpConfiguration>
<all>
<usePreemptive>true</usePreemptive>
</all>
</httpConfiguration>
</configuration>
</server>

Related

how to setup maven setup for jenkins

I'm quite new to Jenkins setup.
Using Eclipse,spring,maven project
Jenkins 의 Global Tool Configuration 에서
NAME: MAVEN_HOME
install from apache 3.6.0
error is following
[INFO] Copying 19 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # egov
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 15 source files to
C:\Users\Administrator.jenkins\workspace\TestJob1\target\classes
[INFO]
[INFO] BUILD FAILURE
[INFO]
[INFO] Total time: 2.154 s
[INFO] Finished at: 2018-12-01T01:44:07Z
[INFO]
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-compiler-plugin:3.1:compile
(default-compile) on project egov: Fatal error compiling:
CompilerException: NullPointerException -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with
the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions,
please read the following articles:
[ERROR] [Help 1]
http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Build step 'Invoke top-level Maven targets' marked build as failure
Finished: FAILURE
In your pipeline (which you should post) run a maven --version and make sure the JRE that is running Maven is also a JDK.
Also, it looks like your Jenkins is running as an administrator. That's not a good idea because the jobs (pipelines) will have admin access to the host.

SonarQube server [https://localhost:9000] can not be reached in Jenkins

I want to build a code coverage from sonarqube in Jenkins. The project is from github. I have configure everything that are necessary but the following errors still arise. Can someone please help me to solve this?
Established TCP socket on 59508
[OData] $ java -cp "D:\Program Files\plugins\maven-plugin\WEB-INF\lib\maven35-agent-1.12-alpha-1.jar;D:\downloads\apache-maven-3.5.4\boot\plexus-classworlds-2.5.2.jar;D:\downloads\apache-maven-3.5.4/conf/logging" jenkins.maven3.agent.Maven35Main D:\downloads\apache-maven-3.5.4 "D:\Program Files\war\WEB-INF\lib\remoting-3.21.1.jar" "D:\Program Files\plugins\maven-plugin\WEB-INF\lib\maven35-interceptor-1.12-alpha-1.jar" "D:\Program Files\plugins\maven-plugin\WEB-INF\lib\maven3-interceptor-commons-1.12-alpha-1.jar" 59508
<===[JENKINS REMOTING CAPACITY]===>channel started
Executing Maven: -B -f D:\Program Files\workspace\OData\pom.xml clean sonar:sonar
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------------------< OData:OData >-----------------------------
[INFO] Building OData 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # OData ---
[WARNING] Attempt to (de-)serialize anonymous class hudson.maven.reporters.MavenArtifactArchiver$2; see: https://jenkins.io/redirect/serialization-of-anonymous-classes/
[WARNING] Attempt to (de-)serialize anonymous class hudson.maven.reporters.MavenFingerprinter$1; see: https://jenkins.io/redirect/serialization-of-anonymous-classes/
[INFO]
[INFO] ----------------------------< OData:OData >-----------------------------
[INFO] Building OData 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- sonar-maven-plugin:3.4.1.1168:sonar (default-cli) # OData ---
[INFO] User cache: C:\WINDOWS\system32\config\systemprofile\.sonar\cache
[ERROR] SonarQube server [https://localhost:9000] can not be reached
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.056 s
[INFO] Finished at: 2018-08-27T00:09:08+08:00
[INFO] ------------------------------------------------------------------------
Waiting for Jenkins to finish collecting data
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.4.1.1168:sonar (default-cli) on project OData: Unable to execute SonarQube: Fail to get bootstrap index from server: Unrecognized SSL message, plaintext connection? -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[JENKINS] Archiving D:\Program Files\workspace\OData\pom.xml to OData/OData/0.0.1-SNAPSHOT/OData-0.0.1-SNAPSHOT.pom
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
channel stopped
WARN: Unable to locate 'report-task.txt' in the workspace. Did the SonarScanner succedeed?
Skipping sonar analysis due to bad build status FAILURE
Finished: FAILURE
for your OData project, when your way to scan the code is via jenkins, you have to set in the settings of jenkins with the hostname, don´t recommend put "localhost" or "127.0.0.1"
Try with $HOSTNAME:
Go to Settings in Jenkins
Move to "Sonarqube Servers"
SonarQube servers
-- Sonarqube instalations
--- ie: http://myserversonarqube:9000
Regards.
Error below is self explanatory. I have below questions
Is Sonarqube running on localhost with port 9000 as Secured (i.e https) ?
Which version of maven you are using? sometimes some of the Sonar plugin versions does not work with old maven versions.
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-
plugin:3.4.1.1168:sonar (default-cli) on project OData: Unable to execute SonarQube:
Fail to get bootstrap index from server: Unrecognized SSL message, plaintext connection? -> [Help 1]
[ERROR]

apache isis simple-app clean install fails

I am trying apache isis for the first time on my Windows machine (following tutorial: https://www.youtube.com/watch?v=OTNHR5EdAs8&list=PLbRpnAmQ6xsBGB_mRAUob8WRBsSL_IsBO), I executed the command:
mvn archetype:generate "-DarchetypeGroupId=org.apache.isis.archetype" "-D archetypeArtifactId=simpleapp-archetype" "-D archetypeVersion=1.16.2""-D groupId=com.mycompany""-D artifactId=myapp""-D version=1.0-SNAPSHOT" "-B"
Which created the myapp in a folder.
After that I Cd'd in myapp folder and executed mvn clean install which eventually failed with following error message:
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] SimpleApp Parent 1.0-SNAPSHOT ...................... SUCCESS [ 4.576 s]
[INFO] SimpleApp Simple Module ............................ FAILURE [ 22.055 s]
[INFO] SimpleApp Application .............................. SKIPPED
[INFO] SimpleApp Webapp 1.0-SNAPSHOT ...................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 36.747 s
[INFO] Finished at: 2018-03-21T08:19:19+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.datanucleus:datanucleus-maven-plugin:4.0.5:enhance (process-classes) on project myapp-module-simple: Error executing DataNucleus tool org.datanucleus.enhancer.DataNucleusEnhancer: InvocationTargetException: java/sql/Date: java.sql.Date -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :myapp-module-simple
PS E:\Apache isis\test_project\myapp>
Did I miss anything? Any dependencies?
As of this writing Apache Isis only runs on Java 7 and 8. We are aiming to be compatible with Java 11 when it ships in Sept/Oct (as that is the next LTS version of Java).

BUILD FAILURE Error: when executing "mvn clean package" command

I'm using following version.
maven: 3.3.9
jdk: java-7-openjdk-amd64
JAVA_HOME="/usr/lib/jvm/java-7-openjdk-amd64/"
I'm getting packages type error when I'm running $ mvn clean package command. I'm new to use swagger to generate documentation(.yml file to .html)
ERROR:
enter code here[WARN] /var/www/html/cg-api-dev-portal/codegen/swagger-codegen/modules/swagger-codegen/src/main/java/io/swagger/codegen/auth/AuthParser.java:21:5: Missing a Javadoc comment. [JavadocMethod]
[WARN] /var/www/html/cg-api-dev-portal/codegen/swagger-codegen/modules/swagger-codegen/src/main/java/io/swagger/codegen/auth/AuthParser.java:28: Line is longer than 100 characters (found 233). [LineLength]
[WARN] /var/www/html/cg-api-dev-portal/codegen/swagger-codegen/modules/swagger-codegen/src/main/java/io/swagger/codegen/auth/AuthParser.java:35:5: Missing a Javadoc comment. [JavadocMethod]
[WARN] /var/www/html/cg-api-dev-portal/codegen/swagger-codegen/modules/swagger-codegen/src/main/java/io/swagger/codegen/auth/AuthParser.java:37:27: Local variable name 'b' must match pattern '^[a-z][a-z0-9][a-zA-Z0-9]*$'. [LocalVariableName]
[WARN] /var/www/html/cg-api-dev-portal/codegen/swagger-codegen/modules/swagger-codegen/src/main/java/io/swagger/codegen/auth/AuthParser.java:46:36: Catch parameter name 'e' must match pattern '^[a-z][a-z0-9][a-zA-Z0-9]*$'. [CatchParameterName]
[WARN] /var/www/html/cg-api-dev-portal/codegen/swagger-codegen/modules/swagger-codegen/src/main/java/config/ConfigParser.java:10: Import statement for 'org.slf4j.Logger' is in the wrong order. Should be in the 'THIRD_PARTY_PACKAGE' group, expecting not assigned imports on this line. [CustomImportOrder]
[WARN] /var/www/html/cg-api-dev-portal/codegen/swagger-codegen/modules/swagger-codegen/src/main/java/config/ConfigParser.java:11: Import statement for 'org.slf4j.LoggerFactory' is in the wrong order. Should be in the 'THIRD_PARTY_PACKAGE' group, expecting not assigned imports on this line. [CustomImportOrder]
[WARN] /var/www/html/cg-api-dev-portal/codegen/swagger-codegen/modules/swagger-codegen/src/main/java/config/ConfigParser.java:17:5: Missing a Javadoc comment. [JavadocMethod]
[WARN] /var/www/html/cg-api-dev-portal/codegen/swagger-codegen/modules/swagger-codegen/src/main/java/config/ConfigParser.java:38:28: Catch parameter name 'e' must match pattern '^[a-z][a-z0-9][a-zA-Z0-9]*$'. [CatchParameterName]
Audit done.
[INFO]
[INFO] --- maven-enforcer-plugin:1.4.1:enforce (enforce-maven) # swagger-codegen ---
[INFO]
[INFO] --- maven-enforcer-plugin:1.4.1:enforce (enforce-versions) # swagger-codegen ---
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # swagger-codegen ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1563 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.5.1:compile (default-compile) # swagger-codegen ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 147 source files to /var/www/html/cg-api-dev-portal/codegen/swagger-codegen/modules/swagger-codegen/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /var/www/html/cg-api-dev-portal/codegen/swagger-codegen/modules/swagger-codegen/src/main/java/io/swagger/codegen/examples/XmlExampleGenerator.java:[17,32] package org.codehaus.plexus.util does not exist
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] swagger-codegen-project ............................ SUCCESS [ 2.958 s]
[INFO] swagger-codegen (core library) ..................... FAILURE [ 11.114 s]
[INFO] swagger-codegen (executable) ....................... SKIPPED
[INFO] swagger-codegen (maven-plugin) ..................... SKIPPED
[INFO] swagger-generator .................................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 14.646 s
[INFO] Finished at: 2017-08-16T15:36:08+05:00
[INFO] Final Memory: 39M/553M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.5.1:compile (default-compile) on project swagger-codegen: Compilation failure
[ERROR] /var/www/html/cg-api-dev-portal/codegen/swagger-codegen/modules/swagger-codegen/src/main/java/io/swagger/codegen/examples/XmlExampleGenerator.java:[17,32] package org.codehaus.plexus.util does not exist
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :swagger-codegen
I've also run debugging mode by running mvn clean package -X, but nothing getting in mind please any one look into it save my life.
Based on the following line:
[ERROR] /var/www/html/cg-api-dev-portal/codegen/swagger-codegen/modules/swagger-codegen/src/main/java/io/swagger/codegen/examples/XmlExampleGenerator.java:[17,32] package org.codehaus.plexus.util does not exist
Looks like you're not using the latest master, which has the following line instead:
16 import io.swagger.models.properties.AbstractNumericProperty;
17 import io.swagger.models.properties.PasswordProperty;
18 import io.swagger.models.properties.UUIDProperty;
Please clone from the latest master.
You can also use the SNAPSHOT version without building the project manually:
https://github.com/swagger-api/swagger-codegen#compatibility

Cannot build Docker image using spotify plugin

I have been using spotify plug-in to build docker images, but it suddenly stops working for some reason, and it spews out error complaining about exec failure on spotify plug-in
[INFO]
[INFO] --- maven-jar-plugin:2.5:jar (default-jar) # SimpleWebApp ---
[INFO] Building jar: /home/test/opd_workspace/my_simple_webapp/target/SimpleWebApp-0.0.1-SNAPSHOT.jar
[INFO]
[INFO] --- spring-boot-maven-plugin:1.3.5.RELEASE:repackage (default) # SimpleWebApp ---
[INFO]
[INFO] --- docker-maven-plugin:0.2.3:build (default-cli) # SimpleWebApp ---
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[INFO] Copying /home/test/opd_workspace/my_simple_webapp/target/SimpleWebApp-0.0.1-SNAPSHOT.jar -> /home/test/opd_workspace/my_simple_webapp/target/docker/SimpleWebApp-0.0.1-SNAPSHOT.jar
[INFO] Copying src/main/docker/Dockerfile -> /home/test/opd_workspace/my_simple_webapp/target/docker/Dockerfile
[INFO] Building image imgprefix/SimpleWebApp
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.282s
[INFO] Finished at: Wed Jun 01 19:42:14 EDT 2016
[INFO] Final Memory: 27M/340M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.spotify:docker-maven-plugin:0.2.3:build (default-cli) on project SimpleWebApp: Exception caught: Request error: POST unix://localhost:80/v1.12/build?t=imgprefix/SimpleWebApp: 500: HTTP 500 Internal Server Error -> [Help 1]
My pom.xml plug-in is very simple, and maven project build and package is ok
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.2.3</version>
<configuration>
<imageName>${docker.image.prefix}/${project.artifactId}</imageName>
<dockerDirectory>src/main/docker</dockerDirectory>
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<include>${project.build.finalName}.jar</include>
</resource>
</resources>
</configuration>
</plugin>
</plugins>
Following the line:
[ERROR] Failed to execute goal com.spotify:docker-maven-plugin:0.2.3:build (default-cli) on project SimpleWebApp: Exception caught: Request error: POST unix://localhost:80/v1.12/build?t=imgprefix/SimpleWebApp: 500: HTTP 500 Internal Server Error -> [Help 1]
It seems you are using UNIX as operating system and Docker answers you an error 500.
I'm using MACOS and It works perfectly for me with the same configuration as yours but before I need to evaluation Docker environment variables in my terminal with:
eval $(docker-machine env default)
Using that library you can't use respository names with uppercase. Only [a-z0-9-_.] are allowed.
So change
SimpleWebApp
to
simple-web-app
or something similar.

Resources