How to create a build job for a simple java project - java

I am very new to Jenkins. I have gone throught the tutorial of jenkins and I want to create a build job for simple java project. I know how to create a freestylebuild but I dont see any connection between the build and the project. Whats happening exactly. I have my project in eclipse and how can i create a build to the project. How do i know that it is the exact build for this project.
Can anyone please help me.

the best thing to do would be to move your build to some standard command line tool, like ant, maven, ivy, gradle etc and then you can reuse the same build from your IDE and on jenkins. note that this doesnt mean giving up using your IDE - many IDEs can import these types of projects directly and give you all the benefits youre used to in an IDE. it simply means that you get a build thats "portable" and not tied down to the specific IDE your using.
personally i think maven is best supported in this regard, but its mostly a matter of personal preference.

Related

How to Convert jbuilder(jpx) project to eclipse new project

we have a jbuilder project which supports java 5. Need to convert this to latest version. Like to change the IDE to Eclipse too.
The code is working in ongoing project need to reuse the same. Plz help on this
in this form I'm afraid community won't be able to help much, SO is intended for asking very precise questions to get precise answers. That's why you've got a downvote I believe. Welcome to the SO though.
Anyway, JBuilder is somewhat old (very old) so If you really think about updating the system, I suggest starting with building a build script in something like maven or maybe gradle.
If you go with maven, for example, you'll have a file pom.xml (or maybe many files if its a multi-module project) that describes a build process. Then it's possible to take advantage of eclipse maven integration and just open a pom.xml as a project (it will work in IntelliJ as well).

Eclipse/NetBeans and Maven integeration

I'm going to ask about Eclipse/NetBeans and Maven, but first let me state my higher goal for which I'm only guessing Eclipse/NetBeans and Maven will be a good combination.
I'm an experienced programmer and computer science tutor in several languages, but I'm learning Java for the first time. I'm helping a student learn it along with me.
I'm most used to Emacs, and I got the JDEE mode working together with Maven quite nicely.
My student finds Emacs unwieldy and wants to use something else. He only knows Atom so far, but that doesn't seem very well integrated with Java yet. Eclipse or NetBeans seem like good bets. (Any known differences, especially for a beginner learning Java?)
My student and I would like to work from the same repo. Because I have a Maven project working nicely with Emacs, I'd like him to be able to work on the same project in Eclipse or NetBeans.
Can I get some suggestions about how to go about this?
I already tried importing my project into Eclipse, but it doesn't work. I go to the importer, then the Maven section, and try to select my project directory. The importer shows the pom.xml but it's grayed-out and can't be selected.
Alternatively, going back to my higher goal which is for my student and I to be able to collaborate, with me on Emacs and him on something more modern and easy for him to assimilate ... a different idea altogether, perhaps?
NetBeans treat maven project as first class citizen. You can open a maven project as is without installing any plugins. That'll be the easiest way for you to forget setup and start coding.

Eclipse-project to makefile for ant/maven/gradle/

Today I faced problems in starting eclipse (reinstall etc. did not work). I had to use a vanilla eclipse and with luck it was working.
With that I experienced the problem of an IDE that is not working. That can be a mess if you need a quick bugfix for a hot system.
Is there a tool that takes an eclipse-project and converts it into a makefile for a more basic tool (like ant, maven, gradle, ...) that work from the commandline?
Sure I can make it by hand but because it should be only a safety I would prefere the automatic way and keep the development-work in the IDE.
EDIT:
Or maybe: Is there an build-command that works on the commandline without starting the IDE?
Thanks!
Running "gradle init" from the command line will attempt to create a build.gradle for your project. If your project layout is "conventional" it might do a good job. If it finds anomalies it tends to give up. Constructing a simple Gradle build script for a simple project takes a few minutes once you get used to it. Searching the web with intelligent queries will tend to find lots of examples.
Adding the "Gradle Nature" in Eclipse is simple if the project is buildable from the command line with Gradle.
You can use m2e eclipse plugin to convert your existing projects to maven projects. But you have to do it before hand(while your eclipse is still working)
https://crunchify.com/how-to-convert-existing-java-project-to-maven-in-eclipse/

Setting up Jenkins to build IntelliJ-project (using BitBucket)

I am trying to set up a Jenkins Server to build my IntelliJ-project (using BitBucketfor VCS (git)).
I have been able to set up IntelliJ to build correctly locally, and I am pushing it to bitbucket. I have also managed to set up Jenkins to get the code from BitBucket.
The problems to actually doing the build process itself, my problem being that I can't seem to figure out how to set it up with Ant / Maven, which I have never used before.
Any good suggestions?
PS: I am still searching for tutorials or anything that gives some help towards achieving this, and will be updating if I find something that helps.
Jenkins can fetch the code from the repository to its workspace, but it cannot build it for you. You need to give him the tool to do that. Popular choices are Maven/Ant/Gradle to handle project building for you.
You need to refer to the proper documentation for either Maven or Ant. The process is too broad and project-specific for me to go into details here, but Jenkins provides nice integration for both. If you know neither of them, I think I'd suggest Maven, but it's up to personal preferences and project needs.
You should first try to build project locally. Once you acomplish that, doing that with Jenkins shouldn't be a problem.

Make Gradle use Eclipse project

I'd like to make Gradle use Eclipse project dependencies. Unlike this question, I don't want to do any export as I don't want to hunt down problems due to forgetting to re-export after a change. And unlike this question, I don't want to integrate Gradle into Eclipse at all, as I'm satisfied with how my Eclipse works (it's much faster than a Gradle build) and I'm also afraid that my Eclipse 3.7.2 may be too old for such games.
Ideally, I'd like something like
dependencies {
compile allFilesFromEclipse()
}
Actually, getting the JARs would suffice.
What I've tried: Just some light googling. I could imagine parsing the .classpath file myself, but it's not done in 5 minutes, so I'm asking if there's an existing solution.
I am afraid you won't find much help. It is not obvious what problem you want to solve here. Most developers prefer to base their build on a build tools rather than expect that they will replicated an IDE setup everywhere.
As for Eclipse 3.7.2: I am not sure why you want to stick with that but gradle eclipse generates files that work with this version.

Categories

Resources