IDE-independent master build for Continuous Integration in a JEE6 project - maven

SHORT VERSION:
In the context of a JEE6 application: What's the best way to setup an IDE-independent, master build process, in a dedicated build server (for CI / Integration test), while still using an IDE at the developer workstations? Which Java IDE is more suitable to such an approach?
LONG VERSION:
We are building a JSF2/PrimeFaces/EJB3.1 JEE6 application to be deployed on a JBoss application server. We need the EAR, WAR and JAR artefacts to be generated in a dedicated machine using an Ant script and be subject to integration testing in a CI fashion (perhaps using Jenkins).
It is also a requirement that the team will use a Java IDE (one kind only, no extra worries there). As a result, developers will produce their local artefacts for the own testing and development using their own, locally-installed IDE. However, I want the main build script on the build server to be independent of any IDE. If the IDE used by the team cannot accept and integrate closely with an externally provided Ant script this can lead to a situation where the main Ant build script will be different and will have to be maintained and evolved independently. So ideally, I would like the same hand-crafted build script to be used both by the developers' IDEs and the build server. In such a setting, if a developer sees the need to modify the Ant script, the modification reaches through git / svn the CI server and is used for subsequent builds. I am stressing "hand-crafted" since, e.g. in NetBeans case, I don't want to use the Ant build script created automatically from the IDE. See the mind-boggling minutiae one has to deal with in this approach (and which I would rather avoid), here.
Therefore I would like to know which of the major Java IDEs (Eclipse, Netbeans, IntelliJ IDEA, other?) is in your opinion more amenable to accepting an externally provided Ant script as the "project definition" and integrating closely to it (in terms of auto-complete and debug, addition of libraries, etc.). The discussion in this SO article seems relevant but is not quite the same situation as my team won't be using two different IDEs. Finally, I understand that Maven might provide a solution since NetBeans can use Maven-based projects where the Maven pom.xml is the project file and one doesn't have to deal with other IDE-specific artefacts, however there is enough Maven FUD on the web (I don't cite sources as I don't want to sidetrack the discussion) that I don't feel comfortable using it for a major undertaking without any significant prior exposure to it.

Related

Is there a way to build the same JavaFX app to a .exe with different build types?

I need to build a javafx aplication to a .exe file, to be used in 3 differents enviroments.
Now, before I build the application to each different enviroment I am changing every variable manualy, like urls, versions and tokens. I know that is a matter of time until I upload the wrong version to the wrong enviroment, so I really need a more automatic process to manage each version.
I read something about maven build profiles but i do not find a way to integrate this in the building of the exe file
This javaFx app is using maven and java10
To build the java code to an exe, I'm using Intellij
Thank you in advance
The big problem is that java 10 is end of lifetime (EOL), so you should already work with java 11, this however is a little more complicated since JavaFx/OpenJfx is now separated. (see https://openjfx.io/)
Anyway to solve your complex needs you should think about a CI platform like as example gitlab CI.
This platforms (with the help of Docker Images) give you the tools you need to properly build and configure complex javaFX build targets and configurations.
But you have to build the .exe file on your own with tools like exe4j if you choose this path.
Side Tips:
In my experience is a lot more easy to build java 11 applications
with gradle instend of just maven since you gain a lot more
flexiblity to solve complex problems
If you stay on java 10 it would be much easier since Java11 + Openjfx
11 required OS dependend builds. (but as I sayed it is EOL)

How to minimize build server project specific configuration?

My case is about having too much complex project configuration logic inside Jenkins jobs definition and in time this becoming harder and hard to deal with. This also prevents you from easily execute build jobs under other build/CI tools.
If those projects would be Java based anyone would probably tell me to use maven as I could put most of the things inside the pom.xml files and have them with the project. Still, in my case is more about C/C++ or even .NET projects for which the all the build scripts are usually in bash (cygwin being a dependency on Windows).
I do know that theoretically I could code the parts that are now inside jenkins job configuration in those bash files but this would clearly require significant effort and would be really hard to tune them to allow to enable and disable different steps based on external conditions.
So, what I am trying here is to achieve a high level of independency regarding the build system, so if I want I could switch it in the long future.
What would you recommend as a solution for that? Obviously I need something that can be used multiplatform and not tightened to a specific build system.
Does it make sense to use maven for that, even if those projects are not Java ones? Personally I am not a big fan of XML configuration files, YAML, JSON and INI being seen as more friendly.
What kind of extra logic existing in Jenkins configuration are we talking about?
One would deployment, as I want to be able to deploy to Nexus or similar repositories, executing tests, code coverage and maybe posting the results somewhere.
As a sidenote, looking at Travis configuration files makes me wonder why Jenkins didn't go for such approach.
Look at Groovy. Jenkins allows direct Groovy code manipulating almost everything. A Groovy script could be used to take care of everything from project specific configuration, and it could even be checked in together with the source code. Then in the Jenkins job, you just have a single build step to call the Groovy script.
The above suggestion, however, is very Jenkins dependent.
Another possibility is an Ant script. The AntExec plugin allows to execute Ant script, along with ant-contrib if needed, using the same tools installation process that the rest of Jenkins use. Therefore, you don't need to worry about Ant being installed on the node: Jenkins will take care of it on demand.
The benefits of the Ant script is that it's not tied to Java concepts as Maven is, it's cross platform (Windows and Linux), and just like the Groovy script example above, it can be checked in along with the rest of the source code.

How to do continuous integration for c# application?

Can anyone advise what is the equivalent of hudson for c# application?
I used to use hudson as a build server for java performing auto deployment for java web and batch job application at scheduled timing and email notify technical team
I like to ask how can i do the same for c# application.
And is there any standard plugins like static code analysis tool in the build server which i can used to scan through the codes
In addition to the great tools mentioned by jamesj, TeamCity works pretty well too. I prefer it to CruiseControl, from a configuration usability perspective, and it is free given you stay within certain constraints.
If you've already invested in TFS as a source control, though, make sure you are getting your money's worth and use it for your builds and deployments too.
If you like Hudson, take a look at Jenkins. I've seen folks using it for .NET builds as well, though I haven't personally used it, and according to their page Jenkins used to be called Hudson, so it would probably be familiar to you.
TFS is great for continuous integration, but you can also use CruiseControl.NET with NAnt. Both of these should be able to run batch jobs, send emails and run automated deployments
StyleCop and FxCop both do static checking and both can be integrated into your build process.

Infrastructure required for TDD?

I am 'relatively new' to unit-testing and TDD. Only more recently have I completed my first production application that has (at least in theory) 100% code coverage. I have done unit-testing in previous projects as well for some time, but not in true TDD fashion and with good code coverage. It had always been an after-thought. I feel I have a pretty good grasp on it now though.
I'm also trying to train the rest of the team on TDD and unit testing so that we can grow togeather and start moving forward with doing unit testing in all of our applications, and eventually progress to doing full TDD w/ automated builds & continous integration. I posted a thread here regarding my plan of attack / training agenda for comments & critisism.
One of the replies (in fact the highest voted) suggested I first setup infrastructure before I go forward with the training. Unfortunately I have no exposure to this, and googling on the topics is difficult because the pages for CruiseControl.NET / nAnt / etc do not really explain the 'why' we should set this up and the 'how' everything connects togeather.
We are a small shop (about 10 developers) and use almost exclusively microsoft technologies and do our development in VB.NET. We are looking to eventually start using C# but that's for another time. I've been using the MSTest project that comes with VS2008 for my unit tests, and I've been building my apps using Visual Studio, and deploying using MSI setup projects... We also (unfortunately) use VSS for our soure control - but that is also on the chopping block and I'd really like to get rid of it and use subversion.
I know that I need to use CruiseControl.NET for CI, and either nAnt or MSBuild for building the applications. And I probably need a build server to run all these builds. But I just can't find anything that 'connects' the dots and explains how they interact with eachother, what should be on your build server, when you should build with your build server (is it just for deployment builds, or even when you just want to compile the app you're developing after making a small change, on your local environment?). I'm also planning on axing MSTest as I've found it to be buggy and will use nUnit instead.
Can anyone perhaps illuminate this gap I have from 'knowing how to do TDD' to 'setting up the proper infrastructure so the whole team can do it and work togeather'? I do understand what continous integration is, but again, I'm not sure how a build server should be setup and how it connects with everything, and why we need one (e.g. the pitch to management).
thanks very much for your time.
What portion of finalbuilder do I need? It seems there's some overlap with final builder and teamcity. Finalbuilder server seems to be a CI server, so I'm guessing I don't need that. FinalBuilder seems to be a build server - but I thought TeamCity is also a build server... And Automise seems to be a visual windows automation tool, like some kind of development platform for winforms apps...
_I also don't see support for final builder in The Team City Supported Apps Diagram : _
Take a look at a webinar I did a few weeks ago - How To Start Unit Testing Successfully. In that webinar I've talked about tools and unit testing best practices and it was aimed at developers just like you who want to introduce unit testing in their organization.
First order of business you want to put a CI (Continuous Integration) process in place and for that you'll need three tools:
Source control
Build server
Build client/script
I hope you already have some form of source control in place so let's talk about the other two.
Build Server - checks the source control and when it changes (or some other condition met) runs a build script on some client (or same machine) there are several build server available I recommend JetBrain's TeamCity it's easy to install and use (great web interface) and is free for up to 20 developers (that's you).
Build Script - on your build client you want to run a build script that would build your solution and run your unit tests. TeamCity has some basic build & test capabilities but for more advanced options (build installer, documentation etc.) you'll need some script runner at work we use FinalBuilder - it's not free but has very good editor. If you're looking for a free alternative have a look at ANT or NANT - but be prepared to edit a lot of XML.
Other tools - Because an important part of successful unit testing is how easy it is to write and run tests on the developer's machines I suggest you check if there are better IDE's or external tools that would help the developers write & run their unit tests.

CI Servers for system simulation

My group work for a software of simulation for plane. To achieve a faster and easier validation and verification, we decided to introduce continuous integration. But I have no idea which CI servers should we choose.
Our contraintes:
- We need to compile in different machine with different platform( Linux, HP ) in local net and in client's net.
I mean, we need to call different functions in different machine in distance. Some of them will need a authorise
- We prefer a CI servers open source
- The sources are in different languages, C, C++, Java ...
- Support SVN, CVS, Clearcase
- Automated tests and reports
- The tests need different machines working together
I've seen teamcity, it seems well, but it's not open source.
Hudson is for you!
Edit to be more precise about your requirements:
Hudson run on a JVM (standalone service, using Jetty, or on a Tomcat server). Thus, the plateform is not a problem.
Hudson is open-source.
Hudson manages Java projects natively, but you can ask him to compile C, C++ or .Net projects.
Support SVN, CVS natively, and a plugin for Clearcase exist (here).
Automated tests and reports: You will need to implement them, of course, but Hudson will launch them for you. For Java projects, simply use Maven for that!
The tests need different machines working together: Hudson can be launched on several machines (one master, several slaves). Each slave can be hosted by any kinf of machine.
+1 for Hudson.
We are using Hudson together with SVN (version control) and Selenium RC (functional testing).
Very easy to set up, has tons of modules for integration, and very visible to all members of the team, especially if you're using the Hudson Build Monitor Firefox plugin.
I used Jenkins earlier, but now I prefer only TC due to it is great for a lot of purposes.
If you need to work with different platforms, it has great opportunity to install a few build agents with OS specified. Also you're able to install so-called Agent Clouds.
If you need to build your applications per branch — it will be done without any extra-scripting.
A lot of VCSs are supported.
Using Maven you're provided to build even Flex applications, even with running automated test (in case of Windows build agent installed).

Resources