I have a jar codebase (developed and successfully compiled in Intellij IDEA) without class files. I want to make jar with that codebase through windows batch-script only. Please help me to make the jar automatically without opening it in any IDE or any manual operation.
Thanks in advance for the help.
You generally do that using build tools like Ant, Maven. Maven is quite more popular these days.
Convert your intellij project into an Maven project like this (IntelliJ - Convert a Java project/module into a Maven project/module), and then execute call mvn clean package from your windows script to build the jar. The jar will be located under ${project.dir}/target
Related
For a project I completed a game in Java on Eclipse using LibGDX. I now need to turn in the source code to my professor. When I export the project and try opening it on a new computer, about a dozen libraries are missing.
I would like to export my entire project so that when the project is opened in eclipse, it will still compile. Is there any way to do this? I know that runnable jars come with the .jar files of the dependencies and no source code, but I need both.
Thanks in advance
Libgdx required number of dependent jars so it's hard to manually add all jars into project.
Make your project gradle based so that When you import your project through gradle into another System then gradle do most of your task* for you.
*gradle try to find dependent jars in file system if already exist then link with your project if not then it download from given repository and link them in your project. Make sure your system is connected with internet when you build your project.
I highly encourage to use Android Studio or IntelliJIDEA.
On window, by default all jars are stored inside
C:\Users\User_name\.gradle\caches\modules-2\files-2.1
In Mac OSX
/Users/User_name/.gradle/caches/modules-2/files-2.1
When you want to deploy or packaging for the desktop run this command on your IDE terminal.
gradlew desktop:dist
You can use maven or gradle to build your project, take a look of one of the tool and it's won't take you too much time. these tool could help you define your own way for build
A much easier way you could use "fat jar". this is an old tool for build a jar with all lib you need and could be run in any place.
I am quite new to Java, although I worked with some projects. I use IntelliJ IDEA, and I have issue with my web project.
Whenever I RUN the project from IntelliJ and when it's made and built - my localizations texts are not shown, but everything is ok if I use mvn install and deploy the war file manually.
What I found is that jars built with IntelliJ don't have MANIFEST.MF generated and couple of other files.
This is IntelliJ jar
This is jar when I run mvn install from console:
Can somebody help with this, why this happens? I have same maven used for compiling as I use for console run:
If you have a Maven project, then you can choose one on the tasks on the right of the editor.
jar or package should generate a JAR file.
Maven is a software tool that helps manage a project and automate builds. By default, however you have to select Maven as the desired type of project when you go to create a new project.
Basically, create a Maven project! :)
I just cloned a Grails project to my local machine (using Mercurial). I am using GGTS for Grails projects, and would like to import the Grails project as an existing project. With a Gradle-built project, I would just apply the Gradle Eclipse plugin and then run gradle eclipse inside the project root.
This generates Eclipse project files and classpath magic for me, so I can import it into my Eclipse workspace.
I'm using GGTS for my Grails projects. But when I open up GGTS and go to Import >> Existing project, and select my Grails project (root dir), it doesn't see the necessary Eclipse project files and can't open it up.
So I ask: is there an equivalent "Grails Eclipse/GGTS" plugin that will allow me to take a Grails project that has no Eclipse files (.project, etc.) and generate them?
The command you are looking for is the Grails command integrate-with. You can read more about it in the Grails documentation.
The integrate-with command will integrate Grails with different IDEs
and build systems based on the arguments provided. For example the
--eclipse command will produce .project and .classpath files for use with Eclipse or Spring Tool Suite (STS).
why do I need to apply: mvn eclipse:eclipse command?
are they equivalent to application container/server?
Is there a file for which customizing is necessary besides web.xml?
when you create a web project using maven, like maven-archetype-webapp. It creates the folder structure as recommend by Maven for a webapp like shown here .
Now when you try to import these folders in Eclipse, it still would look like folders but eclipse cannot understand the nature of these folders. Eclipse relates folders and contents within them to an Eclipse dynamic web project only through its .project , .settings files
So in order for your maven project to be understood by Eclipse, you run the goal mvn eclipse:eclipse. After executing this goal, maven generates the .project, .settings files necessary for eclipse to understand the project as Web project.
This is however optional. You can still import the project as Maven projects within eclipse and continue to use them but you cant rely on Eclipse's features like clean/ build / build automatically.
Though I use eclipse, I dont rely on Eclipse's build feature. I have installed Maven eclipse plugin and that allows me to run maven goals and commands within Eclipse which is as good as running Eclipse's build feature. Hope this helps.
What is the file build.xml?
I was wondering if it is a possibility to import this project in Eclipse or Netbeans using this build.xml. I tried to import the project but I get some errors since one part is created using J2ME and the other J2SE and I guess this file should be the configuration.
build.xml usually is an ant build script.
It contains information necessary to build the project to produce the desired output, be it Javadocs, a compiled project, or a JAR file.
I believe Eclipse has ant built-in, so it should be possible to execute the build.xml by choosing "Run As..." and "Ant Build".
The build.xml file, if it is an ant script, is not used to import the project into an IDE like Eclipse or Netbeans. A build script is used to build the project (or produce some desired output) rather than an mechanism for importing the project into an IDE.
As mentioned by #coobird this is an ant build file. Although IDEs such as Eclipse and Netbeans have ant support built-in, it is also possible to run ant from the command-line and this may be the simplest way to get started if the project has been well created.
See http://ant.apache.org/
for docs.
If you want to try this approach, install ant, cd to the directory with build.xml and issue
ant
Eclipse can be told to build using an Ant script, but you can also use Ant itself.
build.xml file is an Ant(Apache) script.
you can find more information on Ant & build.xml here
In java project build.xml file is used write the ant script.
And from that ant script you can generate war file and can deploy on Tomcat server