IzPack error : Invalid base directory on jenkins-ci - java

first I am not sure if this question belong here or on serverfault.
I am using IzPack for our project. Everything is working fine on my local machine. Unfortunately on my jenkins I have the following error:
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] com.izforge.izpack.api.exception.CompilerException: Invalid base directory: /root/.jenkins/jobs/installer-izpack/workspace/target/staging
I am using:
<groupId>org.codehaus.izpack</groupId>
<artifactId>izpack-maven-plugin</artifactId>
<version>5.0.0-beta8</version>
The jenkins is installed on a debian squeeze.
When i log remotely on the server and verify the target/ directory the jar created from maven is there but there is no "staging" directory. In my honest opinion i think the problem is that jenkins is unable to create the stagging repository. As usual thank you for your time.
How I proceed: I am building some other jar (other jenkins job), then launch the installer to package everything. I don't know if this is enough information. If you need more information or if something is not clear enough please let me know.

This was a permission problem, be sure that jenkins have the permission to create the stagging directory.

Related

Maven clean install COMPILATION ERROR cannot access jar, zip END header not found

When building my application on Jenkins using maven I am seeing the following error after running:
mvn clean install -q -U -T 1.5C -DskipTests -Dsvn.info.skip=true
Error:
** [ERROR] COMPILATION ERROR :
[ERROR] error reading /apps/jenkins/workspace/some_branch/.m2/com.some_company/any_random.jar; zip file is empty
[ERROR] cannot access com.some_company.some_class
cannot access cannot access com.some_company.some_class zip END header not found
cannot access jar
I tried excluding the dependency that was causing the issue as it was transitive but now it happens for other dependencies.
The dependencies are stored in nexus.
I have looked at the JDK being used to build the JARS and considered Network issues but nothing explains this.
Clearing Jenkins and the .m2 folder works sometime for one or two builds but I would like to find a better solution.
Any ideas?
The JAR in your local Maven cache is corrupt.
Just delete the file
.m2/com.some_company/any_random.jar
and rerun your goal again.
Maybe your network or internet connection is slow or your hard disk need check.
Error reproduction
I've experienced the same error as soon as I've added a global variable at the beginning of a tag in the pom.xml file:
<url>${env.CI_PROJECT_URL}/api/v4/projects/000/packages/maven</url>
Just for a try, I added the a letter at the beginning, even if it doesn't resolve to an existing URL:
<url>a${env.CI_PROJECT_URL}/api/v4/projects/000/packages/maven</url>
And the compilation worked, but the publication could not due to the wrong URL.
Solution
I've solved the error by just interpolating the domain of the server, while I manually wrote the protocol part as https:
<url>https://${env.CI_SERVER_HOST}/api/v4/projects/000/packages/maven</url>
In your case you may need to apply a similar modification in order to solve the issue.

What does "[ERROR] file doesn't exist" means when doing maven install?

When I execute maven install in my gitlab build, I get the following error message:
12338 [INFO] Installing com.mycompany:myartifact:1.0.0-SNAPSHOT at end
12338 [INFO] 12338 [INFO] --- maven-bundle-plugin:3.3.0:install
(default-install) # myartifact --- 12411 [ERROR] file doesn't exist:
file:/root/.m2/repository/com/mycompany/myartifact/1.0.0-SNAPSHOT/myartifact-1.0.0-SNAPSHOT.jar
I don't understand what does it mean. The file obviously doesn't exist because it was never installed in that environment, so it's strange that maven would complain about it.
I suppose this error hides some other error, like no write rights? But I see not other error in log. The build seems to be successful.
Try to make a clean install, maybe it's just a local repository issue
mvn clean install
When you do maven install, It usually looks into your .m2 folder and searches for the existence of the dependencies(mentioned in pom.xml). If it doesn't exist, maven will automatically download it. So the build will be successful.

Do I need to install Apache Maven on my PC first, or is it enough to install the plugin in Netbeans to run a Maven project?

I build an Apache Project in java which runs fine on my laptop, now that I try to run the same project in Netbeans on my work PC I get an error:
Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (default-cli) on project aping: Command execution failed.
With a reference to:
For more information about the errors and possible solutions, please read the following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
The Maven plugin in Netbeans was installed by default. When I tried to find out if the Apache version in the POM file was correct I tried to check the version on my PC with mvn -version I got the error:
'mvn' is not recognized as an internal or external command,
operable program or batch file.
Does this mean that Maven is not installed on my PC and should I also install Maven on my PC first in order to use the plugin, or should just installing the plugin be enough and do I have a different problem?
The error message you see is
Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (default-cli) on project aping: Command execution failed.
This is a message from the Maven executable embedded inside Netbeans (so Maven is running), saying that a specific maven plugin (here exec-maven-plugin) failed. This is most likely trying to invoke another program on your computer that is not installed so Netbeans (and hence the embedded Maven) can see it.
If you want to run maven outside Netbeans, you must download and install a copy and invoke the "mvn" binary inside.
You Have to install Maven To run Maven on your PC - http://www.avajava.com/tutorials/lessons/what-is-maven-and-how-do-i-install-it.html see how to install maven
in linux - http://www.mkyong.com/maven/how-to-install-maven-in-ubuntu/
I mistakenly assumed that the problem had something to do with Maven, the problem seems to be something in my source code unrelated to Maven. When I change some of the code the program is build succesfully

Maven Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean Failed to delete access_log

I'm trying to run simple struts project using maven and tomcat.
When I'm trying to exucute next goals: clean install tomcat7:run I'm getting MojoExecutionException :
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean
(default-clean) on project myproject: Failed to clean project: Failed to delete
D:\EclipseWorkspace\myproject\target\tomcat\logs\access_log.2015-02-21
-> [Help 1]
I've googled and understand that tomcat uses this access_log file, where he logs user requests. And by the time when I want to execute goals listed above, as I'm using Eclipse IDE, the JVM denies for deleting this file.
I saw same questions: Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.4.1, Maven - Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.4.1:clean.
But don't understand the proposed solutions to such problem.
I've seen this sort of error whenever there's a process that's holding a lock on a file in some subfolder that Maven is trying to clean. Check that your Tomcat instance is really stopped (look for java processes in Task Manager that shouldn't be there). I've also created this issue for myself by opening the access log in a text editor, and then forgetting to close the editor after shutting down the Tomcat and trying to run a new build.
Micahel Peacock and khmarbaise were right about some proccess is blocking the deletion.
This is some tip for maven newbies, like me.
I've faced such problem, because after running Tomcat with maven goals clean install tomcat7:run I stopped it either through shutdown batch file in ${CATALINA_HOME}/bin directory or through installed Eclipse Tomcat plugin by clicking on the next label:
But to do it in the right way you should click on stop label in console view:
Then locale tomcat instance will be stopped and no such errors would appears, because proccess will shutdown gracefully.
In my case it was a different program than Tomcat blocking a folder that should be deleted. Here is my approach based on the answer of Michael Peacock:
This way you on Windows 10 you can find out which process blocks the file or folder:
Search for "Resource Monitor"
Go to the tab "CPU"
Scroll down to "Associated Handles"
Search for the file or folder in the search bar of that tab.
Kill the process, if you think this is the blocking one.
If you do not know which file can not be deleted check Maven's log. There it tells you which file or or folder it was deleting before the error occurred. Most likely this is the one that caused the problem.
I had the same problem in Fedora. In my case owner of targe directory was changed to root
usring --> [chown your-username target] I fix it.

Play 2.2.0 - How to create a war file

I am using play 2.2.0 for my application so inorder to host the application i need to create a war file so i can host in my Tomcat7 server. So is there any method to
Clean and Build as we have options in netbeans with console.
Create war file so i can host.
The method to create a war file as in normal jsp hosting i paste all my class files in WEB_INF folder but here how can i do please tell the procedure. I just gave few try this i have mentioned below i know i am wrong please show me the right way.
F:\Play_workspace\ThemePractice>play war
[info] Loading project definition from F:\Play_workspace\ThemePractice\project
[info] Set current project to ThemePractice (in build file:/F:/Play_workspace/Th
emePractice/)
[error] Not a valid command: war (similar: start)
[error] Not a valid project ID: war
[error] Expected ':' (if selecting a configuration)
[error] Not a valid key: war (similar: watch, run, apiUrl)
[error] war
[error] ^
There is a plugin for creating a war file, however Play 2.2.x is currently not supported.
Although a branch exists on Github for this feature, it looks like it is still being worked on. You'd have to contact the maintainers for a time line.
Update: It is now possible to create a war file with Play 2.2.x, see Paul D. Eden's comment.
Play 2.1.4 onwards, support for packaging into a war file has been withdrawn. There is a workaround for the same which can help you in generating war file. You fool the compiler and let it think that we are using earlier version of Play. For details refer to the following link :-
Create War from Play 2.2.1 application
It is working till day for me :)
Add addSbtPlugin("com.github.play2war" % "play2-war-plugin" % "1.2-beta4") to your plugins.sbt
Add the following to your build.sbt
import com.github.play2war.plugin._
libraryDependencies ++= Seq(
"com.github.play2war" % "play2-war_2.9.1" % "0.8.2"
)
Play2WarPlugin.play2WarSettings
Play2WarKeys.servletVersion := "2.5"
Now you can freely use the "play war" command.

Categories