How to disable maven release plugin check local modifications? - file

I use maven release plugin. In my pom exists and Ant task that automatically fix some properties files with additional information. This fixes should not be in SCM.
But maven don't finish with success for error:
Cannot prepare the release because you have local modifications
Does it possible to set some parameters to don't check local modifications?
Thanks.

I'm not very familiar with maven-release-plugin, but I can see that there is a checkModificationExcludes property that you can use for your purpose. The config should be somewhat like this:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.2.2</version>
<configuration>
...
<checkModificationExcludes>
<checkModificationExclude>file_1</checkModificationExclude>
<checkModificationExclude>dir_1/file_2</checkModificationExclude>
</checkModificationExcludes>
</configuration>
</plugin>

We were trying to run the release from jenkins but it always failed with the same message...
Cannot prepare the release because you have local modifications
... which was weird, because we use jenkins to check out and build the latest sources before releasing.
We finally figured out that the problem was that we were building on a Windows node and some file paths were too long which caused the maven-release-plugin to complain about local modifications. Switching to a linux node solved this problem.

Removing my project's target folder from source control fixed this issue for me.

I would suggest fixing your build process, so that it does not 'fix up' files that are under SCM. There are several ways of doing this, the simplest is to copy properties files in question to some directory under ${project.build.outputDirectory}, and run your Ant script on these files, rather than originals

#AndrewLogvinov's answer is half way there. The other half is mentioned in this:
I discovered that the comparison
in org.apache.maven.shared.release.phase.ScmCheckModificationsPhase.execute()
strips the path and compares file names only. So, I changed my pom to ignore
application.properties instead of ${thewholepath}/applications properties.
Lo and behold, success.
For some weird reason, you can't include paths in this tag. You can only specify file names.

It worked on Windows in my case by renaming job name to a shorter length (About 20 characters).
In my case, Jenkins job name and also svn branch name were longer (About 40 characters).
If some file paths are too long it causes the maven-release-plugin to complain about local modifications. Jenkin creates a local workspace with the job name
e.g. For and as below, Jenkins job while releasing will start complaining about local modifications.
D:\dev.env\data\jenkins\jobs\<LongerJobName>\workspace\<LongerBranchName>\testCommonJar\src\main\java\com.example.webservice.service.TestServiceImpl.java

Related

Spring Boot. Path for automatic scripts running at the start

For automatic scripts running at the start I use following property:
spring.datasource.data=classpath:base.scripts/*
It runs all the scripts in src/main/resources/base.scripts
But imagine my scripts files are located not in resources. (In another project directory, for example src/test/resources/base/scripts). How can I specify that path?
This is how I fixed it:
spring.datasource.data=file:src/main/resources/base.scripts/*

Nagios Plugin Error: (No output on stdout) ... failed. errno is 2: No such file or directory

I am using custom Nagios plugins for the first time and am running into this error when I create a service for the plugin.
(No output on stdout) stderr: execvp(/usr/local/nagios/libexec/check_load.py, ...) failed. errno is 2: No such file or directory
The plugin works when I run it on the command line, however does not work when it runs within Nagios.
I followed these steps to get the plugin into Nagios
https://assets.nagios.com/downloads/nagiosxi/docs/Managing-Plugins-in-Nagios-XI.pdf
Here is what it looks like in the Nagios UI
The plugin is in the correct path: /usr/local/nagios/libexec and the resource.cfg file has the same path within it.
I tried two separate plugins, both which work on the command line, and the result is the same error.
The error indicates the file location is incorrect, however the plugin is in the specified directory and runs with no errors within that directory.
I am totally stumped and appreciate any help.
For anyone reading this, I solved the problem.
The first time I added the plugin, I forgot to add the python extension. When I updated the already created plugin, Nagios still threw the error.
Once I completely deleted the plugin and re-created it the 'file not found', error went away.
I faced a similar issue when I was trying to add a custom plugin ( I had custom plugins in ruby and python ).
The issue was the missing shebang line at the start of the script (which determines the script's ability to be executed like a standalone executable).
For example, if you have a python plugin custom-plugin.py then make sure this script has shebang at the start of script #!/usr/bin/env python3. Also if you have other scripts (ruby, bash etc.) make sure to add the appropriate path at the start of your scripts.
Also, check the path for plugins Nagios version. For my setup path was /usr/local/nagios/libexec/ and make sure your custom plugin is executable and has correct ownership permissions.
Sample custom template I used :
define command {
command_name check_switch_health
command_line /usr/local/nagios/libexec/check_snmp.rb --host $HOSTADDRESS$ --model "$ARG1$" --community "$ARG2$"
}
The above workaround worked for me.

Can the IAR command line tool "iarbuild" do a build all?

From the IAR command line, it's easy to build a particular configuration, and obviously, if I want to mimic the "build all" behavior I just run my own batch file with the configs I want.
How do I handle the case where I want to build all configs, but I don't know in advance what configurations are available?
Using Jenkins, for instance, if a developer adds a configuration in the IAR IDE, it won't be included in a build until the Jenkins scripts are manually updated. I just want Jenkins to build all the configurations without caring what they are called. In the IAR GUI for setting up batches, there is an option to rebuild all so there must be something somewhere. Thanks!
You can specify * as configuration name to build everything, like this:
c:\> iarbuild myproject.ewp -build *
One solution I've implemented years ago for this problem was to read the configuration names from the .ewp file and use them for the build.
Regards
Yves

Is there a limit on .class file name lengths in google app engine, outside of jar files?

I'm getting errors when I attempt to run my project deployed to app engine. I see issues like:
java.lang.ClassNotFoundException: com.seattleglassware.AuthServletSupport$$anonfun$finishOAuth2Dance$1$$anonfun$apply$33$$anonfun$apply$34$$anonfun$apply$37$$anonfun$apply$40$$anonfun$apply$41$$anonfun$apply$42$$anonfun$apply$45$$anonfun$apply$47$$anonfun$apply$48$$anonfun$apply$49
The class name looks reasonable (well, for certain values of reasonable - this is code generated by the Scala compiler). I see the file in my local web/WEB-INF/classes/com directory and I can decompile it with javap (so I don't think it's corrupt or anything silly like that.) Everything works fine running on a local debug server.
Even more strange, I can pour all the .class files in web/WEB-INF/classes into a jar file like this:
cd to the web/WEB-INF/classes directory
jar cf ../lib/classes.jar .
And now, if I upload the project (pressing the deploy button in Eclipse), I don't see those ClassNotFoundException errors. Delete the jar file, re-upload the project, get the errors again.
I'm wondering if there's some sort of limit on the names of .class files? Or something else happening in the deployment process that's causing this to happen?
EDIT: running from the command line made this much more clear (using maven now):
SEVERE: Invalid character in filename: WEB-INF/classes/com/seattleglassware/AuthServletSupport$$anonfun$finishOAuth2Dance$1$$anonfun$apply$33$$anonfun$apply$34$$anonfun$apply$37$$anonfun$apply$40$$anonfun$apply$41$$anonfun$apply$42$$anonfun$apply$45$$anonfun$apply$47$$anonfun$apply$48$$anonfun$apply$49.class
But it still looks to me like that's a valid filename.
The inclusion of "special" characters in the file name may be the issue here.
There is currently an open issue regarding "special" characters in project file names.
Issue 2211: Special characters are not supported in the filenames in the project
The original issue was reported by a Python App Engine user, however if you look in the comments you'll see that it apparently affects Java users as well.

Is JRebel necessary to run Maven?

Greetings,
I am trying to start a scala/liftweb project for deployment on Google App Engine. To do this, i need to package it up as a .war using maven.
However, whenever I run the 'mvn' command, I am met with:
Error opening zip file or JAR manifest missing : /Applications/JRebel/jrebel.jar
Error occurred during initialization of VM
agent library failed to init: instrument
Is there something wrong with my maven or do I need Jrebel? I see jrebel is not free which is why I am so surprised.
thanks!
No, JRebel is definitely not required to run Maven.
As Matt mentioned, JRebel is not required to run Maven. However, ZeroTurnaround does offer a free version that works with Scala. You can get it here:
http://sales.zeroturnaround.com/
As for your error - it indicates you are trying to start the JVM as though you are using JRebel. What is the full Maven command you are running? What is in your MAVEN_OPTS environment variable? If either of them contain something like -noverify -javaagent:/Applications/JRebel/jrebel.jar, then that's your problem.
One of the reason of the problem is a blank in the path of jrebel.jar
Make sure that there is no blank in the path like in "Program Files"

Resources