No windows executable is generated when building tinyMediaManager - java

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.

Related

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

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?

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.

Compiling Java Project into Jar file by from command line instead using Maven

I am looking into the github project located at,
SymbolicRegressionInJava. I am familiar compiling java code into jar file but not one huge project using Maven. I looked into Maven and it is another complex system that need to be figured out. The bin folder has already a compiled jar file. I used a command
jar -tf symbolic_regression_1.0.jar
to see the list of classes used for the project. It has both gp and ga directories. I added ga (from another github) folder where is gp folder is at ../src/.. Instead of Maven (which I cannot figure it out even with a tutorials), I attempted manually by typing
jar cvf test1.jar *
It compiled, however, it failed to run like symbolic_regression_1.0.jar. What I am missing here?

Package not found even though the jar is in WEB-INF/lib

I have a Tomcat 8 web project that I started in Netbeans.
In Netbeans I setup some Global Libraries that I then added to the project.
Building the project in Netbeans works perfectly.
The problem is when I try to build on a Unix platform using Ant.
I use the build.xml file automatically generated by Netbeans, the only difference is that I now have to specify where these "Global" libraries are, I do this as so:
ant -Dlibs.spring-framework-4.0.6.classpath="../libs/spring-framework-4.0.6.RELEASE" clean dist
This however results in these kinds of errors:
error: package org.springframework.beans.factory does not exist
If I go and look inside the build folder in web/WEB-INF/lib, the jar is there and if I look inside it I do find the org.springframework.beans.factory class.
If I run ant in debug mode it clearly states that is copying over the libs:
[copy] Copying /libs/spring-framework-4.0.6.RELEASE/spring-beans-4.0.6.RELEASE.jar to /App/build/web/WEB-INF/lib/spring-beans-4.0.6.RELEASE.jar
As I understand it, the WEB-INF/lib directory is on the classpath by default. Is this not what happens and do I need to specifically tell it to add this directory to the classpath?
Found the solution myself, it turns out I have to specifically reference each and every jar, it is not enough to reference the directory.
So this:
ant -Dlibs.spring-framework-4.0.6.classpath="../libs/spring-framework-4.0.6.RELEASE" clean dist
Should have been this:
ant -Dlibs.spring-framework-4.0.6.classpath="../libs/spring-framework-4.0.6.RELEASE/spring-aop-4.0.6.RELEASE.jar:../libs/spring-framework-4.0.6.RELEASE/spring-aspects-4.0.6.RELEASE.jar:../libs/spring-framework-4.0.6.RELEASE/spring-beans-4.0.6.RELEASE.jar:../libs/spring-framework-4.0.6.RELEASE/spring-context-4.0.6.RELEASE.jar:../libs/spring-framework-4.0.6.RELEASE/spring-context-support-4.0.6.RELEASE.jar:../libs/spring-framework-4.0.6.RELEASE/spring-core-4.0.6.RELEASE.jar:../libs/spring-framework-4.0.6.RELEASE/spring-expression-4.0.6.RELEASE.jar:../libs/spring-framework-4.0.6.RELEASE/spring-framework-bom-4.0.6.RELEASE.jar:../libs/spring-framework-4.0.6.RELEASE/spring-instrument-4.0.6.RELEASE.jar:../libs/spring-framework-4.0.6.RELEASE/spring-instrument-tomcat-4.0.6.RELEASE.jar:../libs/spring-framework-4.0.6.RELEASE/spring-jdbc-4.0.6.RELEASE.jar:../libs/spring-framework-4.0.6.RELEASE/spring-jms-4.0.6.RELEASE.jar:../libs/spring-framework-4.0.6.RELEASE/spring-messaging-4.0.6.RELEASE.jar:../libs/spring-framework-4.0.6.RELEASE/spring-orm-4.0.6.RELEASE.jar:../libs/spring-framework-4.0.6.RELEASE/spring-oxm-4.0.6.RELEASE.jar:../libs/spring-framework-4.0.6.RELEASE/spring-test-4.0.6.RELEASE.jar:../libs/spring-framework-4.0.6.RELEASE/spring-tx-4.0.6.RELEASE.jar:../libs/spring-framework-4.0.6.RELEASE/spring-web-4.0.6.RELEASE.jar:../libs/spring-framework-4.0.6.RELEASE/spring-webmvc-4.0.6.RELEASE.jar:../libs/spring-framework-4.0.6.RELEASE/spring-webmvc-portlet-4.0.6.RELEASE.jar:../libs/spring-framework-4.0.6.RELEASE/spring-websocket-4.0.6.RELEASE.jar" clean dist

Eclipse JAR export settings for external JAR file creation(for import into another project)

I have a project where I want to add an external JAR file. The desired external JAR file has a nifty Github page with source, but no pre-compiled JAR file.
These are the steps I've completed so far:
1. I have downloaded the source in a zip. (its Twinkle from SwingFx.ch in case you're interested)
2. I have extracted the zip file to my workspace.
3. I have created a new project with the same name as the extracted folder from the zip file. (project loads the source successfully)
4. I select the export option from the File menu and selected the 'JAR file' option and clicked next.
Note: I had to add an external library to the above Twinkle project for it to build successfully (in case that makes a difference to the settings).
On the JAR File Specification page there are multiple check-box options available(see below):
Export generated class file and resources
Export all output folder for checked projects
Export Java source files and resources
Export refactorings for checked projects
Compress the contents of the JAR file
Add directory entries
I am not sure which are supposed to be selected and if it makes a difference in the behaviour of the project I will add the (soon-to-be) exported JAR file to. I tested it by exporting with the default settings. This worked ok.. However, I now do not know if I should have chosen different settings in case of any reasons I am not aware of. I am not sure if there are specific settings I should choose when I intend for the JAR file to, specifically, be added as an external JAR file to another project.
Please enlighten me!
This is a traditional Java library that uses Maven. It should be fairly easy to build using Maven, which should be better and quicker to build this, if you already have Maven and git installed.
Let's consider that you did not download the source file as a zip, but take the github approach, where you'd use git to download the source code.
If you don't have git, download its latest version and install it.
If you don't have Maven, download its latest version and install it.
Once Maven and git are installed, make sure the Maven and git binaries are configured in your environment PATH variable. If not set, you would, on the Windows platform and for Maven binaries, set it this way (using the default installation path):
set PATH=%PATH%;C:\Program Files (x86)\Apache\maven-3.1.1\bin
Create and change directory in a work directory of your choice, that we'll refer to %work_directory% from now on.
Run the following:
cd %work_directory%
git clone https://github.com/spreiter301/Core.git
git clone https://github.com/spreiter301/Twinkle.git
cd Core
mvn clean install
cd ../Twinkle
mvn package
6. Retrieve the twinkle-1.0.0.jar file in the newly created '%work_directory%/Twinkle/target' folder.
In this case, it was necessary to retrieve the Core library because it is a dependency of the Twinkle project. Normally, this is not necessary because dependencies are automatically retrieved from a maven repository. But in that case, that dependency is not available on any Maven repository. Hence we manually retrieved the dependency from github, compiled it and installed it in your local cached repository. Then we could package the Twinkle project into the JAR file.
This should do it. If you want a 5 minutes tutorial on Maven, there is a tutorial for this here. I highly recommend it, you will encounter this often in the Java world. Maven is the standard build tool for Java, just like 'make' is for C, 'rake' for Ruby, 'sbt' for Scala, etc..! Good luck with the rest.

Categories

Resources