how to run gradle with class files inside the build folder? - java

I am creating RESTAPI application using gradle. I would like to deploy to server without the original java source code.
./gradlew build will generate build folder, however, ./gradlew run will also generate build folder and run the class files, resources folder and jars in build folder.
Is it possible to skip the generate build folder and run the build folder directly? If not, how can i start gradle with class files, jars and resources folder?

Related

No windows executable is generated when building tinyMediaManager

I am trying to build a Windows distribution of tinyMediaManager. Its Gitlab instructions says:
Building from source tinyMediaManager is compiled using Apache's build
automation tool, Maven. Check that you have it installed (and git, of
course) before attempting a build.
Clone this repository to your computer git clone
https://gitlab.com/tinyMediaManager/tinyMediaManager.git
Build using:
maven mvn package
After that you will find the packaged build in the folder dist
However, when I build using the command "mvn package" I get a folder called target with some other files, including some .jar files, instead of a "dist" folder with .exe for windows. When I executed them, nothing happens.
This is my first time compiling source from java into a Windows executable.
Why is the "dist" folder with a Windows executable not created?
The documentation is indeed not correct, mvn package does not generate the dist folder.
There is a profile called dist that you need to build with in order for the folder to be generated:
mvn package -Pdist
The above command will generate the dist folder, including a zip file with the Windows executable.
I guess the build behaviour changed along the way, and that they missed to update the readme.

How to build a java app in Maven with resources outside of ".jar"

I made a little java app that modifies an Android Studio project and executes "gradlew.bat" to build the .apk and move it to an "output" folder.
As you might expect this project has to be saved outside of the .jar (AFAIK I can't execute a Gradle build inside of it).
I converted it from a plain Idea project into a Maven project to automate my workflow a bit. But Maven packs my resources in the "res" folder inside the jar. It also builds in the "target" directory and I want it in an isolated folder.
I need Maven to build the .jar file with the source files in an isolated folder and, in the same folder, copy the resources to the file system instead of the .jar.
Edit: For clarification. I want the project to have a more standarized layout so I can push the project to Heroku. Heroku will compile and execute the .jar using its Maven configuration but will not pass the other files to the filesystem to be along the .jar and instead, pack the resources inside the .jar.
The result I want is:
Whenever I execute a Maven build, the "target" directory should have the .jar file and two resources (A folder with files and a .ini file) within the same directory. It is not possible to do that myself as Heroku works automatically.

Clean all files except target in maven

In maven is it possible to clean all files inside project directory except target directory after maven compile step? How can I setup this?
My requirement is something like this -
I run maven compile command which generates classes file under target directory.
Now I want to copy only generated target folder and pom.xml to another directory and build jar/war from that location, can I do something like this?
Also can maven copy a external properties file(outside of project) to projects WEB-INF/classes folder?

Using SherlockActionBar library by using its Jar file in android

I am using SHERLOCK-ACTION-BAR in my project
I successfully am able to run the project using the library refered in eclipse
What i am not able to do::
I am trying to add JAR file to libs in my project and run it
(removing the reference i made earlier to my previous library)
So i copied the JAR from Libs of Sherlock library project and added
to my project
When i do this i am not able to import the class file from JAR
Where can i download the correct JAR
You can add JAR from Project - Properties.
Then go to Java Build Path and add your JAR or External JAR.
Clean your project after add it ;)

Deploy Eclipse 4.1 Project

I have create a simple program using Eclipse 4.1.. I wanted to build or deploy my project into a .jar. I also added external libraries in my project. I wanted the output same as in Netbeans with the .jar file and lib folder in the dist folder, but there should be also a folder named help and lang.. How can I do this with eclipse?!
Follow the steps provided here.
Or if you don't want to complex things up, select Runnable JAR file instead of JAR file set the directory where the .jar is to be written then click Finish.
Eclipse will create the [Project Name]_lib directory for the external libraries included in the project.

Categories

Resources