I need change the sonar url without change settings.xml, so i have the following:
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>3.4.1.1168</version>
<configuration>
<sonar.host.url>http://sonar.viavarejo.com.br</sonar.host.url>
</configuration>
</plugin>
My sonar.host.url didn't work, just ignore, see the error:
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.4.1.1168:sonar (default-cli) on project myproject: Unable to execute SonarQube: Fail to get bootstrap index from server: Failed to connect to localhost/0:0:0:0:0:0:0:1:9000: Connection refused (Connection refused) -> [Help 1]
Important: I can't change the settings.xml file.
You can set the URL as a property:
<properties>
<sonar.host.url>http://<server>:<port>/</sonar.host.url>
</properties>
or directly in the command line usind
mvn sonar:sonar -Dsonar.host.url=http://<server>:<port>/
Related
So here in my case, checkstyle-suppressions.xml is specified in both checkstyle.xml and pom.xml:
checkstyle.xml:
<module name="SuppressionFilter">
<property name="file" value="checkstyle-suppressions.xml"/>
</module>
pom.xml
<project>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.17</version>
<configuration>
<configLocation>checkstyle.xml</configLocation>
<suppressionsLocation>checkstyle-suppressions.xml</suppressionsLocation>
</configuration>
</plugin>
</plugins>
</reporting>
</project>
I'm not quite sure whether there's the need to define it in both files, one with SuppressionFilter module and <suppressionsLocation> tag in the pom.
And I want use https://github.com/openmrs/openmrs-core/blob/master/checkstyle.xml with other projects. However when doing so with <configLocation> set to https://github.com/openmrs/openmrs-core/blob/master/checkstyle.xml in the pom.xml, checkstyle-plugin fails with error:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:2.17:check (validate) on project webservices.rest: Failed during checkstyle configuration: cannot initialize module SuppressionFilter - Cannot set property 'file' to 'checkstyle-suppressions.xml' in module SuppressionFilter: InvocationTargetException: Unable to find: checkstyle-suppressions.xml -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:2.17:check (validate) on project webservices.rest: Failed during checkstyle configuration
Caused by: org.apache.maven.plugin.MojoExecutionException: Failed during checkstyle configuration
Caused by: com.puppycrawl.tools.checkstyle.api.CheckstyleException: cannot initialize module SuppressionFilter - Cannot set property 'file' to 'checkstyle-suppressions.xml' in module SuppressionFilter
Caused by: com.puppycrawl.tools.checkstyle.api.CheckstyleException: Cannot set property 'file' to 'checkstyle-suppressions.xml' in module SuppressionFilter
I'm not quite sure whether there's the need to define it in both files
No need. If defined in the POM, maven will add it to the configuration behind the scenes.
Failed during checkstyle configuration
Unable to find: checkstyle-suppressions.xml
It was unable to find your file to load.
It tries to find the file as a direct file system path (relative paths should be based off your current working directory), a URL, or a resource in your program. http://checkstyle.sourceforge.net/config_filters.html#SuppressionFilter
I was added as a developer to the Maven project and now I need to make a release.
I've added nexus-staging-maven-plugin to pom.xml file.
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.3</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
Also I've added distributionManagement to pom.xml
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
I've placed my credentials to ~/.m2/settings.xml
<settings>
<servers>
<server>
<id>ossrh</id>
<username>divanov-oss.sonatype.org-account</username>
<password>divanov-oss.sonatype.org-password</password>
</server>
</servers>
</settings>
I also tried to create and use "Access User Token" on oss.sonatype.org
as my credentials.
Now I'm executing to deploy release into maven central.
mvn clean deploy
which ends up in the error:
[ERROR] Failed to execute goal org.sonatype.plugins:nexus-staging-maven-plugin:1.6.3:deploy
(injected-nexus-deploy) on project project: Failed to deploy artifacts:
Could not transfer artifact
project:jar:4.4.0-20141228.104011-1 from/to ossrh
(https://oss.sonatype.org/content/repositories/snapshots): Access denied to:
https://oss.sonatype.org/content/repositories/snapshots/project/project/4.4.0-SNAPSHOT/project-4.4.0-20141228.104011-1.jar,
ReasonPhrase: Forbidden. -> [Help 1]
or
[INFO] Performing remote staging...
[INFO]
[INFO] * Remote staging into staging profile ID "329a0bc2b7ce06"
[ERROR] Remote staging finished with a failure: 403 - Forbidden
[ERROR]
[ERROR] Possible causes of 403 Forbidden:
[ERROR] * you have no permissions to stage against profile with ID "329a0bc2b7ce06"? Get to Nexus admin...
How can I check my access rights within Maven project I'm trying to release?
Your credentials are likely fine, you'd be getting a 401 error if they weren't. You're getting 403 (forbidden). This means the credentials were accepted, but you don't have permission to publish the artifacts. The most common cause of this is that you are using a different Maven group ID than the one assigned to you. File an issue at https://issues.sonatype.org in the "Community Support - Open Source Project Repository Hosting" and we'll get this worked out.
The credentials that you need to use shouldn't be of Sonatype JIRA, but of oss.sonatype.org. You need to register there separately.
[Update] The question was changed, so this answer is not relevant anymore. I'll keep it, since it's a common mistake.
Can any one help out of this:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.
4:assembly (bin-assembly) on project ingest-scripts: Execution bin-assembly of g
oal org.apache.maven.plugins:maven-assembly-plugin:2.4:assembly failed: For arti
fact {rome:null:null:jar}: The artifactId cannot be empty. -> [Help 1]
Maybe it's because you forgot the groupID
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
</plugin>
That's just a guess!
Please tell me, if it's working this way...
I have a simple project with just one class file and one junit test file. Trying and testing a release using mvn release:prepare but fetting following exception while executing the following command. I have SVN server installed but on a different Windows machine. I do have the SVN client (TortoiseSVN) installed on the current machine.
Can anybody please guide as to what am I missing ?
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.0:prepare (default-cli) on project maven-svn-release: Unable to check for local modifications
[ERROR] Provider message:
[ERROR] The svn command failed.
[ERROR] Command output:
[ERROR] 'svn' is not recognized as an internal or external command,
[ERROR] operable program or batch file.
[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.
pom.xml configuration:
<scm>
<connection>scm:svn:https://gsi-541243.gsiccorp.net/svn/maven-rnd/maven-svn-release/trunk</connection>
<developerConnection>scm:svn:https://gsi-541243.gsiccorp.net/svn/maven-rnd/maven-svn-release/trunk</developerConnection>
<url>https://gsi-541243.gsiccorp.net/svn/maven-rnd/maven-svn-release/trunk</url>
</scm>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<configuration>
<tagBase>https://gsi-541243.gsiccorp.net/svn/maven-rnd/maven-svn-release/tags</tagBase>
</configuration>
</plugin>
</plugins>
</build>
I am deploying builds to local and remote Jboss AS 7.1.1 Final at port 9999. Maven uses jboss plugin 'jboss-as-maven-plugin:7.1.1.Final' to manage builds to servers. I have confirmed that server is up and running and port is accessible at 9999. But "many times" build fails with following error for both local and remote Jboss. Jboss ic configured in Standalone mode single node cluster.
Stranglely build doesn't fail every time but most of the time. Not sure if we need to upgrade Maven plugin to higher version.
[INFO] o.h.m.e.h.MavenExecutionResultHandler - Build failed with
exception(s) [INFO] o.h.m.e.h.MavenExecutionResultHandler - [1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to
execute goal
org.jboss.as.plugins:jboss-as-maven-plugin:7.1.1.Final:undeploy
(default-cli) on project Test: Error executing UNDEPLOY [DEBUG]
Closing connection to remote [ERROR] Failed to execute goal
org.jboss.as.plugins:jboss-as-maven-plugin:7.1.1.Final:undeploy
(default-cli) on project Test: Error executing UNDEPLOY:
java.net.ConnectException: JBAS012144: Could not connect to
remote://localhost:9999. The connection timed out -> [Help 1]
UPDATE
<plugin>
<groupId>org.jboss.as.plugins</groupId>
<artifactId>jboss-as-maven-plugin</artifactId>
<version>7.1.1.Final</version>
<configuration>
<filename>${project.build.finalName}.jar</filename>
<username>${userName}</username>
<password>${password}</password>
</configuration>
</plugin>
I am now using latest version of Maven plug-in but it seems that connection timeout error is more frequent now. I am starting to think if Jboss behaves differently when trying to make too many remote deployment with different sub projects of the application. I am having 21 sub projects being deployed from a master POM. Sample configuration is as follows
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.master</groupId>
<artifactId>master</artifactId>
<version>1.0.0</version>
<packaging>pom</packaging>
<name>Master</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<modules>
<module>module1</module>
<module>module2</module>
<module>module3</module>
<module>module4</module>
<module>module5</module>
<module>module6</module>
<module>module7</module>
<module>module8</module>
<module>module9</module>
<module>module10</module>
<module>module11</module>
<module>module12</module>
<module>module13</module>
</modules>
First, check plugin configuration.
For example:
<plugin>
<groupId>org.jboss.as.plugins</groupId>
<artifactId>jboss-as-maven-plugin</artifactId>
<version>7.9.Final</version>
<inherited>true</inherited>
<configuration>
<hostname>${jboss.hostname}</hostname>
<port>${jboss.port}</port>
<username>${jboss.user}</username>
<password>${jboss.pass}</password>
<timeout>30000</timeout>
</configuration>
</plugin>
If hostname, port number(default 9999), username and password are ok, you can try increasing "timeout" (default is 5000ms, you can try with 30000ms).
It worked for me.
4 Possible Solutions to Question
Remove your Local Cache settings which will be your local m2 repo Or Point to new m2 repo from your maven settings.xml file.
Try to connect to your local nexus/archiva (if any other) using relevant/appropriate credentials.It is only your Maven Plugin causing this problem.
Try to use the latest JBoss Deploy Plugin available in this link.
Alternatively check your windows/Linux firewall settings have been enabled or it.