简体   繁体   中英

Is there a plugin in intellij that packages everything in a project and creates a shell script to launch the application?

This seems like a straight forward plugin, I wonder if it already exists (yeah, I searched). I have a project with some lib dependencies.

What I'm looking for does the following:

  1. jars up classes built from your source code into one or more jars
  2. gathers up the jar files your source depends on
  3. creates a little shell script to set the classpath to the dependencies, and launches your main class.
  4. zips all this up in a neat little package so you can take this zip/tar and deploy it, say on another machine.

Surely someone has written a simple deployer like this? I can't find one in the plugins repo

I am not sure if IntelliJ has something like that, but Maven surely does what you need. You can use Maven ( http://maven.apache.org/ ) with the Assembly plugin ( http://maven.apache.org/plugins/maven-assembly-plugin/ ). With some easy configuration you will get Maven to package a zip file for you with all the required JAR files in a subfolder. Then you can run the application with some script like the one below:

execute.cmd:
%JAVA_HOME%\bin\java -Xms512m -Xmx512m -classpath "../lib/*" yourPackage.YourClassName

The script above assumes a pre-defined JAVA_HOME environment variable. There are other options such as WinRun4J to launch your application.

Maven is a pretty awesome tool - not only you can generate a ZIP file with everything from the command line, but you can also manage all your application dependencies, and it integrates nicely with a broad range of SCM tools to give you powerful tools, like the release plugin ( http://maven.apache.org/plugins/maven-release-plugin/ ) and others.

Such tool was created several years ago and is called BuildDesk . However, it was not very popular and the project was discontinued (no updates since 2009). I don't know if it's still compatible with the current IntelliJ IDEA version.

At the moment the solution is to use Maven, Ant or a combination of them with the built-in Artifacts feature . IDEA can already create an executable Jar with all the required dependencies, the only extra you need is a shell script or an executable wrapper like launch4j or Exe4j . If you have a service, consider JavaServiceWrapper .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM