Clean and build Netbeans java project from command line - java

I have a java application project (ant) under Netbeans and I want to programmatically call the action similar to Netbeans' clean and build (clean the project and than build it) command using something like javac or ant. How am I supposed to do that? I've already look at this but it didn't help me.

Netbeans for clean and build is using Ant (If it is not a maven project). Make some research of it (try with Writing a Simple Buildfile) and you will be able to do the same with your project by writing Ant build script for it.

Related

How to export a javafx maven project with jfoenix components using the javafx-maven-plugin

I have been working on a javaFx project with maven. exporting this project to an executable file seems to very hard.
though my research i found that javafx-maven-plugin is the tool for that and with the help of my last question i figured out the configuration to run the project using the plugin.
How to run a maven java fx project that includes jfoenix using javafx-maven-plugin
my assumption was that if i could get the project to run, then exporting using the same tool can be easy. but i have been try all possible changes and nothing works.
export the project using
mvn javafx:jlink
run the project by using the following cmd at the bin
java -m "moduleName"/"reference of the the main class"
all the technical information are in the linked question. how can i export this project properly.

How to build artifacts from IntelliJ via command line

I am looking to make my development life a little easier. Currently I have to go through multiple steps to deploy my code base to a test environment to allow for QA to do their work. These steps are not difficult just that I want to automate it so that it can auto run twice a day.
One thing that I am having trouble figuring out what to do is to automate my build artifacts phase in IntelliJ. I have two modules in my IntelliJ projects and I build artifacts for one of them.
The steps I go to build the artifacts are
Build --> Build artifacts --> Select Artifact to build
I was wondering if something like Ant would be able to do the job? I am not familiar with Ant, so I thought I was ask people opinions on it first.
Ant can do what you want, but personally I prefer Gradle or Maven to build my projects. You can use them even to deploy your app into test servers. Here's a simple tutorial for you to start learning gradle (my favorite one at the moment)
Usually what I do is have my run/debug also build my artifacts. On the bottom of "Run/Debug Configurations" in Intellij you can add "Build Artifact" to "Before launch: Make, Activate tool window".
You can probably build the artifact with ant by generating build.xml through Menu --> Generate Ant Build but would have to keep it updated. Maven or Gradle is a better option in this regard.
Ideally though, you would want a CI tool like Jenkins (there are others) to deploy your code to your environments. So when you push (with your VCS) or trigger it, everything is built by Jenkins and sent to where it needs to be for the QA team.
http://codurance.com/2014/10/03/guide-to-deploying-artifacts-with-jenkins/
To build Artifact from command line I used Ant.
These are the steps:
Install Idea Ant Generator Plugin
https://plugins.jetbrains.com/plugin/14169-ant-build-generation
and use "generate ant build ..." to create an ant xml file of your project (and modules).
Open Ant tool window and add the file generated.
Click build.all.artifact to test the build
Now download Ant from Apache repository https://downloads.apache.org/ant/binaries/
Unzip and add the folder to your SYSTEM PATH.
Now from command line:
ant -buildfile myfileant.xml build.all.artifacts

How to integrate Eclipse with a build management tool?

I have simple HelloWorld project in Eclipse. Usually I do 'run as application' my HelloWorld.Java file to execute the project. Now I want to invoke HelloWorld via a build management tool. But it has to be from Eclipse environment and not through a jar file.
This requirement sounds weird but that's what I am trying to do.
If you want to use Jenkins, you will need SVN (or git).
So for the "Eclipse" environment, you will need subclipse in order to use SVN in Eclipse.
And have a look here :https://marketplace.eclipse.org/content/hudsonjenkins-mylyn-builds-connector

Making automatic jar through windows batch script with intellij IDEA's codebase

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

build.xml in Java project

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

Categories