How to create a jar from a github Project - eclipse

I want a jar file for the project https://github.com/tsantalis/RefactoringMiner but I don't see any link on the site which gives me jar file and there is no POM.xml
I need to run the project on Eclipse

From the page you linked:
In order to build the project, run ./gradlew jar (or gradlew jar, in Windows) in the project's root directory. Alternatively, you can generate a complete distribution zip including all runtime dependencies running ./gradlew distZip.

Related

Gradle other project as dependency in eclipse

I have a web application which depends on another standalone project. Simply the web project requires a standalone project jar to be in classpath. I have built the standalone project jar with gradle and included that in web application's WEB-INF/lib folder. The project is running as expected. Now i want to make it automatic by adding that project as dependency. This is also achieved using the following code.
settings.gralde
include 'job-invoker'
project(':job-invoker').projectDir = new File(settingsDir, '../job-invoker')
build.gradle
dependencies {
compile project(':job-invoker')
.
.
}
I'm able to build the war file from command line using gradle and run it in tomcat. But i'm getting errors in eclipse. I'm not able to run the project in eclipse due to the compilation errors. Can some one please help me. Thanks in advance.
Finally i found a solution for this by installing the other project in maven local repository and adding this as a regular dependency in project. Reference code is given below.
Other project Gradle file
apply plugin: 'maven'
group = 'com.xxx.job'
version = '1.0'
Run gradle install command on this project. Then add mavenLocal() to your repositories in another project and add the dependency
compile 'com.xxx.job:job-invoker:1.0'

How to add external jar files in gradle project inside the netbeans

I have created the Gradle web app which is running inside the NetBeans. Now I want to add some external jar files in it so how can I add the jar from NetBeans.
Modify your Gradle project to add your dependency and refresh it in NetBeans to pick up the changes. There is plenty of documentation how to do it. For example How to add local .jar file dependency to build.gradle file?
If you really need to take that .jar from a local directory,
Add next to your module gradle (Not the app gradle file):
repositories {
flatDir {
dirs 'libs'
}
}
dependencies {
compile name: 'gson-2.2.4'
}
ref:check here

Gradle / Eclipse

I have a gradle project in eclipse (using STS plugin). I have a properties file I want on my classpath. This file is read during tests. In my project view, I put this file on
\src\test\resources\test.properties
When I run
gradle test
from the command line, this file is read.
But when I run eclipse it is not.
To reiterate what superEb said in his comment:
src/test/resources must be designated as a source folder for Eclipse to include your properties file on the classpath for tests.
You can in include Gradle's Eclipse plugin to handle this for you automatically with:
apply plugin: 'eclipse'

How to create executable single jar which include webapp resources by sbt-assembly with scalatra

I'm making webapp using scalatra framework via sbt & xsbt-web-plugin.
I want to package all resources(templates, css, js) into a single jar.
In sbt with sbt-assembly plugin, assembly command makes single jar which includes all of project's dependencies.
$ java -jar myproject.jar
and I open it in browser
Could not load resource: [/WEB-INF/views/index.scaml]; are you sure it's within [null]?
I unzipped jar to confirm that it does not include src/main/webapp/*.
How can I config sbt for including src/main/webapp/* and building executable jar?
Resources are meant to be put under the resources folders. There are two such folders:
src/main/resources for resources available at runtime
src/test/resources for resources available only during testing
sbt will package those automatically for you when you run package-war or test. The project does not need to have the assembly plugin for sbt to include resources.
In your case, you should put the WEB-INF directory in src/main/resources/WEB-INF/.

How to have maven build my project with all the dependencies in a separte folder, ready to package?

How do I create a package of a Maven project that contains the jar with my classes, plus a directory like "lib" with all the needed dependencies? I'm using netbeans ...
You can copy required libs into a folder using Maven dependency plugin copy-dependencies goal.
In addition to that you can use Maven assembly plugin to create an archive containing your jar and this lib folder.