mvn release:prepare do not commit and do detect local changes - java

I have two strange behavior with my mvn release:prepare
1/ It do not stop when there is local changes not committed even if it detect them !
[DEBUG] release.properties not found - using empty properties
[INFO] Verifying that there are no local modifications...
[INFO] ignoring changes on: **\pom.xml.next, **\release.properties, **\pom.xml.branch, **\pom.xml.tag, **\pom.xml.backup, **\pom.xml.releaseBackup
[INFO] Executing: cmd.exe /X /C "git rev-parse --show-toplevel"
[INFO] Working directory: D:\XX
[INFO] Executing: cmd.exe /X /C "git status --porcelain ."
[INFO] Working directory: D:\XX
[DEBUG] A testFab2
[DEBUG] ?? release.properties
[WARNING] Ignoring unrecognized line: ?? release.properties
[INFO] Checking dependencies and plugins for snapshots ...
What is the release version for "XX-parent"? (YY:XX-parent) 1.3.2: :
2/ It doesn't commit and push the modified pom.xml...
And more confusing, the normal behaviour occurs well on my colleague computer. We have the same configuration. Here some tech infos :
Git
git version 2.16.2
mvn --version
Apache Maven 3.5.3 (3383c37e1f9e9b3bc3df5050c29c8aff9f295297; 2018-02-24T20:49:05+01:00)
Maven home: D:\tools\apache-maven-3.5.3
Java version: 1.8.0_162, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.8.0_162\jre
Default locale: fr_FR, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
plugin maven-release
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
<configuration>
<goals>install</goals>
<tagNameFormat>#{project.version}</tagNameFormat>
<autoVersionSubmodules>true</autoVersionSubmodules>
<preparationGoals>verify</preparationGoals>
<arguments>-Dmaven.javadoc.skip=true -Dmaven.site.skip=true</arguments>
</configuration>
</plugin>
I hve tried downgrade the pluginlike in this post : mvn release:prepare not committing changes to pom.xml, but without success
If you have some ideas...
Thank you

Use maven command with PushChanges=false.

Related

maven-checkstyle-plugin not working with google_checks.xml on macOS

I have a Java / Maven project that I build at home with Windows and was executing checkstyle properly. It's using the builtin ruleset, but I tried an external file as well.
Checking out the same code / pom.xml it doesn't seem to work with macOS. The odd thing is if I use the sun_checks.xml it's working fine. Using 8.8 didn't make a difference.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.0.0</version>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>8.7</version>
</dependency>
</dependencies>
<configuration>
<encoding>UTF-8</encoding>
<configLocation>google_checks.xml</configLocation>
</configuration>
</plugin>
If I run it like that, it will just complete without doing any checks:
mvn checkstyle:check -X
Apache Maven 3.5.2 (138edd61fd100ec658bfa2d307c43b76940a5d7d; 2017-10-18T18:58:13+11:00)
Maven home: /gdev/apache-maven
Java version: 1.8.0_161, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre
Default locale: en_AU, platform encoding: UTF-8
OS name: "mac os x", version: "10.13.3", arch: "x86_64", family: "mac"
[..]
[DEBUG] The resource 'google_checks.xml' was found as jar:file:/Users/udoheld/.m2/repository/com/puppycrawl/tools/checkstyle/8.7/checkstyle-8.7.jar!/google_checks.xml.
[DEBUG] headerLocation LICENSE.txt
[DEBUG] JarResourceLoader : trying to load "jar:file:/Users/udoheld/.m2/repository/com/puppycrawl/tools/checkstyle/8.7/checkstyle-8.7.jar"
[..]
[DEBUG] Unable to process header location: LICENSE.txt
[DEBUG] Checkstyle will throw exception if ${checkstyle.header.file} is used
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
If I run the same with the sun checks:
[..]
[DEBUG] The resource 'sun_checks.xml' was found as jar:file:/Users/udoheld/.m2/repository/com/puppycrawl/tools/checkstyle/8.7/checkstyle-8.7.jar!/sun_checks.xml.
[DEBUG] headerLocation LICENSE.txt
[DEBUG] JarResourceLoader : trying to load "jar:file:/Users/udoheld/.m2/repository/com/puppycrawl/tools/checkstyle/8.7/checkstyle-8.7.jar"
[..]
[DEBUG] Checkstyle will throw exception if ${checkstyle.header.file} is used
[INFO] There are 7 errors reported by Checkstyle 8.7 with sun_checks.xml ruleset.
[ERROR] src/main/java/com/udoheld/Test.java:[0] (javadoc) JavadocPackage: Missing package-info.java file.
Trying the checkstyle on the commandline without using maven seems to work as well java -jar ~/Downloads/checkstyle-8.8/checkstyle-8.8-all.jar -c ../checkstyle-google.xml *:
Starting audit...
[WARN] /gdev/git/test/src/main/java/com/udoheld/Test.java:18: Comment has incorrect indentation level 4, expected is 6, indentation should be the same level as line 19. [CommentsIndentation]
As the logs show I'm using Maven 3.5.2 on macOS 10.13.3 with Java 1.8.0_161 64 Bit.
How do I get the maven-checkstyle-plugin working with the google ruleset on macOS?
It does actually run it but does not print the results. Change your plugin's configuration like below.(enabling console output)
<configuration>
<!-- <violationSeverity>warning</violationSeverity> -->
<consoleOutput>true</consoleOutput>
<encoding>UTF-8</encoding>
<configLocation>google_checks.xml</configLocation>
</configuration>
If you want to fail the build when check style finds warnings, uncomment the violationSeverity line. But it does not print total number of errors found, only prints each error it finds.

mvn build is failing for tigase-web-ui-2.0 final

We downloaded the pom.xml available at
https://projects.tigase.org/projects/sureim/repository/revisions/33b2a6f9cc27ced875f7e773f041ac381e2115b9
for
tigase-web-ui-2.0 final
and mvn build is failing
[ERROR] Failed to execute goal on project tigase-web-ui: Could not
resolve dependencies for project
tigase.sure.web:tigase-web-ui:war:2.0: Could not find artifact
tigase.sure.web:theme:jar:2.0.0 in gwt-mobile-webkit
(http://gwt-mobile-webkit.googlecode.com/svn/repo) -> [Help 1]
Where do we find the relevant war / jar files.
Our mvn version is
Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T17:27:37+05:30)
Maven home: D:\Spacers\Gurupgm\Apache-maven-3.3.3\bin..
Java version: 1.8.0_45, vendor: Oracle Corporation
Java home: D:\Spacers\Gurupgm\Java8\jre
Default locale: en_IN, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "dos"
Thanks for your help.
Try downloading the jar manually from the link click
After downloading install into maven repository by using the below command
mvn install:install-file -DgroupId=tigase.sure.web
-DartifactId=vomsProxyInitGUI -Dversion=2.0 -Dpackaging=jar -Dfile=/home/tigase-web-ui-2.0.jar

Maven build error on MAcOS : " unmappable character for encoding UTF-8"

I working on MacOs on Eclipse Kepler.
I'm trying to run maven with UTF8 to be OS dependent.
I think I have tried a lot of solutions that seems to work for others not for me.
export JAVA _TOOL_OPTIONS -Dfile.encoding=UTF-8
When i Run in console :
mvn -version
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
Apache Maven 3.0.4 (r1232337; 2012-01-17 09:44:56+0100)
Maven home: /usr/share/maven
Java version: 1.6.0_45, vendor: Apple Inc.
Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Default locale: fr_FR, platform encoding: UTF-8
OS name: "mac os x", version: "10.8.4", arch: "x86_64", family: "mac"
But i am running maven via Eclipse and Eclipse says platform encoding macRoman...
When i run a
clean install
Apache Maven 3.0.4 (r1232337; 2012-01-17 09:44:56+0100)
Maven home: /Users/JP/git/CleanOmicsTracer/EMBEDDED
Java version: 1.6.0_45, vendor: Apple Inc.
Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Default locale: fr_FR, platform encoding: MacRoman
OS name: "mac os x", version: "10.8.4", arch: "x86_64", family: "mac"
In my pom.xml i have setted as this to set UTF-8:
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<project.resources.sourceEncoding>UTF-8</project.resources.sourceEncoding>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.1</version>
<configuration>
<tag>${project.build.finalName}</tag>
<url>http://localhost:8080/manager/text</url>
<server>localhost</server>
<charset>UTF-8</charset>
<update>true</update>
<path>/${project.build.finalName}</path>
<username>jp</username>
<password>camille</password>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
<encoding>${project.build.sourceEncoding}</encoding>
<sourceEncoding>${project.build.sourceEncoding}</sourceEncoding>
<fork>true</fork>
<meminitial>128m</meminitial>
<maxmem>1024m</maxmem>
<url>http://localhost:8080/manager/text</url>
<server>localhost</server>
<path>/${project.build.finalName}</path>
</configuration>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<configuration>
<encoding>${project.build.sourceEncoding}</encoding>
<sourceEncoding>${project.build.sourceEncoding}</sourceEncoding>
</configuration>
</plugin>
It's not working, the é and è in my .java create an error :
When i change in maven-compile-plugin this line
macRoman
, it will be ok but no more Os Dependent and characters will be misunderstood in my other computer in linux.
When i clean install, the ouput is ok for ressources but nothing is done for the compiler :
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) #
CleanOmicsTracer --- [INFO] Using 'UTF-8' encoding to copy filtered
resources. [INFO] Copying 36 resources [INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) #
CleanOmicsTracer --- [INFO] Changes detected - recompiling the module!
[INFO] Compiling 142 source files to
/Users/JP/git/CleanOmicsTracer/target/classes [INFO]
[INFO] --- maven-resources-plugin:2.6:testResources
(default-testResources) # CleanOmicsTracer --- [INFO] Using 'UTF-8'
encoding to copy filtered resources. [INFO] skip non existing
resourceDirectory /Users/JP/git/CleanOmicsTracer/src/test/resources
UPDATE : I change eclipse configuration to use /usr/share/maven and not the embeded version.
I still have errors whereas this time the platform encoding is well set to UFT-8:
Apache Maven 3.0.4 (r1232337; 2012-01-17 09:44:56+0100)
Maven home: /usr/share/java/maven-3.0.4
Java version: 1.6.0_45, vendor: Apple Inc.
Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Default locale: fr_FR, platform encoding: UTF-8
OS name: "mac os x", version: "10.8.4", arch: "x86_64", family: "mac"
[ERROR] /com/clb/genomic/lyon/validator/ParticipantExistenceValidator.java:[101,93] unmappable character for encoding UTF-8
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException:
Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project CleanOmicsTracer: Compilation failure
If it works when the platform encoding is set to MacRoman but fails when it is set to UTF-8 then it means ParticipantExistenceValidator is not in UTF-8 encoding. You need to fix the file, not the configuration.
One easy way to do this is to use native2ascii twice, first to convert MacRoman to unicode escapes and then again with -reverse to convert the escapes back into UTF-8.

Maven 3.1.0 breaks Google App Engine Maven Plugin

Looks likes Google App Engine plugin is broken with new maven 3.1.0 release. When I am trying to run development server, I am getting exception
Caused by: java.lang.ClassNotFoundException: org.sonatype.aether.RepositorySystem
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230)
... 57 more
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
My maven version is
Apache Maven 3.1.0 (893ca28a1da9d5f51ac03827af98bb730128f9f2; 2013-06-28 05:15:32+0300)
Maven home: C:\Program Files\Maven\apache-maven-3.1.0
Java version: 1.7.0_25, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.7.0_25\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
There is a conluence page about this problem on Apache site http://cwiki.apache.org/confluence/display/MAVEN/AetherClassNotFound
If you need to use the plug-in with Maven 3.1.0 then you can use the latest 1.8.3-SNAPSHOT version (from the Sonatype repository, see below) which has this problem fixed.
<plugin>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>1.8.3-SNAPSHOT</version>
</plugin>
<pluginRepository>
<id>sonatype-nexus-snapshots</id>
<name>Sonatype Nexus Snapshots</name>
<url>https://oss.sonatype.org/content/repositories/google-snapshots/</url>
</pluginRepository>
See also this question:
Move to version 3.8.0 of the android-maven-plugin, it solves the issue.
I had the same problem, but moving back to Maven 3.0.5 solved the problem

What is a POM on maven?

I'm trying to follow the get started manual of maven, but I receive this error
c:\Ambiente\workspace>mvn archetype:generate \ -DarchetypeGroupId=org.apache.maven.archety
pes \ -DgroupId=com.mycompany.app \ -DartifactId=my-app -X
Apache Maven 3.1.0 (893ca28a1da9d5f51ac03827af98bb730128f9f2; 2013-06-27 23:15:32-0300)
Maven home: C:\Ambiente\apache-maven-3.1.0
Java version: 1.7.0_25, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.7.0_25\jre
Default locale: pt_BR, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "x86", family: "windows"
[INFO] Error stacktraces are turned on.
[DEBUG] Reading global settings from C:\Ambiente\apache-maven-3.1.0\conf\settings.xml
[DEBUG] Reading user settings from C:\Users\t316360\.m2\settings.xml
[DEBUG] Using local repository at C:\Users\t316360\.m2\repository
[DEBUG] Using manager EnhancedLocalRepositoryManager with priority 10.0 for C:\Users\t3163
60\.m2\repository
[INFO] Scanning for projects...
[DEBUG] Extension realms for project org.apache.maven:standalone-pom:pom:1: (none)
[DEBUG] Looking up lifecyle mappings for packaging pom from ClassRealm[plexus.core, parent
: null]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.078s
[INFO] Finished at: Mon Jul 22 17:23:03 BRT 2013
[INFO] Final Memory: 11M/247M
[INFO] ------------------------------------------------------------------------
[ERROR] The goal you specified requires a project to execute but there is no POM in this d
irectory (c:\Ambiente\workspace). Please verify you invoked Maven from the correct directo
ry. -> [Help 1]
org.apache.maven.lifecycle.MissingProjectException: The goal you specified requires a proj
ect to execute but there is no POM in this directory (c:\Ambiente\workspace). Please verif
y you invoked Maven from the correct directory.
what is POM and what do I suppose to do to have this file?
A pom.xml file describes how to build a project. It can be considered the Java version of a Makefile in C/C++ or setup.py in Python. Are you following a specific example?
The pom.xml file is the core of a project's configuration in Maven. It is a single configuration file that contains the majority of information required to build a project in just the way you want. The POM is huge and can be daunting in its complexity, but it is not necessary to understand all of the intricacies just yet to use it effectively.
Below is just a simple example:
<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.mycompany.app</groupId>
<artifactId>my-app</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Maven Quick Start Archetype</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
To build the dependencies that you specified in pom.xml file execute:
mvn clean package
After a successfull mvn package you will see something like below:
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2 seconds
[INFO] Finished at: Tue Jul 23 (Time..)
[INFO] Final Memory: 3M/6M
[INFO] -----------------------------
the above command will download all the dependencies to your home directory /home/user/.m2/..
Have a look on this How to create a maven project
Also have a look to Maven in 5 min
The way you tried the command is supposed to work for Linux environment and you are running Windows. Please double check the command (likely removing the \ ) and it should work just fine.

Categories