Where to place the scripts - scripting

I have written several scripts for my hudson builds. I have place them in the workspace of the particular job i am working on.
I was hoping to know where the best place to put the scripts. Is somewhere in the file system then best place? What if we move build machines? Does hudson designate a place for scripts?
Please and thank you.

I would suggest putting them inside your project folder /hudson/jobs/MyProject instead of inside the workspace. The workspace could be overwritten.

Do you use source control? If so you can put them in there and get hudson to pull them from there...

If these scripts are related to a particular project, bundle them with the project. Don't put them somewhere else.
If these scripts are used for more then one project, put them in your source control as a a separate project. Than you can pull them down every time you pull your project. If your scm plugin for hudson does not support configuring two separate sources (like subversion does), then just pull the build script using a command line tool for your scm as your first build step.
Build scripts need to be versioned the same way as you code is versioned.

Related

In Intellij ,Class files from 2 Different projects (created in different directories) interfere with each other

My Source code: 2 different branches from same repository. Both have 80% same code. Packages also same. But 20% classes are different in both branches. Its because of different features being developed in these branches.
My Intellij version is 2018.2.7 Community Edition
I cloned the repository in 2 different folders.
consider first one: C:\SourceCode\myRepo and move to branch1 from master
consider second one: C:\SourceCode\SecondCopy\myRepo and move to branch2 from master
Now I create 2 different projects in IntelliJ. One from C:\SourceCode\myRepo, Second from C:\SourceCode\SecondCopy\myRepo.
I build first project using git bash for windows using simple 'mvn clean install' command. (outside Intellij). Open Intellij. Run the application on Jetty. It goes good.
I have the second IntelliJ Project open as well in new Window. Now I build this second project in git bash using 'mvn clean install'(again outside Intellij). But as soon as I do that, the first project starts showing exceptions in code for the java classes which are not present in second project.
Even the application which was Already running using 'Run configuration of Intellij' in Jetty in First project, starts throwing class not found errors.
How can I resolve it and work on 2 projects having slightly different code but 80% same code, same packages etc. parallelly? What am I missing here? My intention is not to run Jetty parallelly. But to be able to compile these 2 projects independently and be able to Run Jetty in any one project anytime without interfering with other project.
These projects are big projects and hence, I want to initiate build and run for one project. Till the time its up and running, I want to be able to work on the other one parallelly in a way that, this work after compiling/auto building in this project doesn't impact the other one where I just started the application.
It is killing my productivity. Please help!
Use different Maven coordinates for the projects.
Someone told me that... Its happening because I am using maven and after building, maven keeps the project libraries that it builds in local repository. So both the projects after building are trying to keep the jars in the same folder from where Jetty is reading as well. Hence there is interference.
I have not tried. but If I keep 2 separate local repositories for both the projects, it should solve, but with this all the dependencies will also be unnecessarily duplicated. So the solution is as mentioned by #Andrey is that I keep the maven coordinates separate for both the projects, so that 2 separate jars are created for both. Thanks Andrey. I wont necessarily change maven coordinates for the all modules but for one where there is difference of code in both the projects. Hope this answer helps someone.

How to create a project from the commandline?

Is it possible to create an IntelliJ project purely from the command line?
We are looking a streamlining the on-boarding of new hires and off-shore resources and to minimise the amount of project setup they have to perform. As such, it would be nice if we had the IDE already configured for them to get started.
There is a legacy plug-in for Maven to generate IntelliJ IDEA project files, but we don't recommend using it.
Instead, it would be easier to instruct users to open pom.xml file in the IDE so that the import is performed automatically.

maven build with remote pom.xml

I would like to know weather there is a way/plugin to build a project with maven using a remote pom.xml(http://host:port/pom.xml) with out a pom.xml file in the directory where I run "mvn install".
I need this as I want to effect maven dependencies of multiple clients by making changes to one remote file hosted at (http://host:port/pom.xml).
I am not aware of a way to do this. Generally, if you are doing development with multiple developers, you should be using source control. For example, if you are using subversion, you would just make changes to the pom, commit, and the other developers can update.
Of course using a version control is absolutely necessary...It would quite helpfull to use a Maven Repository Manager to interchange the artifacts with each other simply by deploying the artifacts to a central Repository Manager in your company and furthermore it will increase the build time.
If you are on Windows, you can try mapping the remote location (possibly a network share or an FTP location) to a local drive, and then executing the maven command in your console for the mapped location. It should work.
Else, you can distribute the pom.xml file via an email and ask the users to use it as their project file.
The other option is to use a Version Control System (VCS) such as Mercurial and keeping your pom.xml stored in the repository and make it accessible for the users to checkout. So far, this is the best way to make sure everyone is using the same file.

Auto discover projects in continous integration Tools

We have a code base composed of many projects. Currently each time we add a project on SVN we must reconfigure CruiseControl to start build and test on such project.
I'm looking for a tool (better if open source) able to scan the SVN repository and find new projects by itself.
A project can be "a SVN folder containing trunk, tags, branches subfolders".
Even better if the tool supports multistaged continous integration and build on demand.
Thanks
In general, projects tend to be just different enough to require the build system to be set-up manually. However, you could probably use something like Jenkins with some bash scripts to achieve what you're looking for; eg. if your SVN server has an HTML index of all the projects, you could set up a bash script to poll that page for changes then tell Jenkins to add a new project from a template.

Bamboo Integration

This is my second question on Bamboo (My First One). My understanding after reading suggested info, I need a build tool, like nAnt or MSbuild to write a script that gets the source code and builds it (I am working on a .net 3.5 with silverlight project). After, when deploying, I need to write scripts to move my files to the diff servers. Please tell me whether I am going in the right direction or not. Can I use ant, maven, bash scripts to do the same with a .net project?
Yes, that is true:
Bamboo is the central management server which coordinates all work
Bamboo itself has interfaces and plugins for lots of types of work
Bamboo basically needs to first get your source from a source repository (lots of plugins here for a variety of systems)
Then it needs to do the build - that can be done by using MSBuild to build your Visual Studio solution, or it could be a batch file to call your XYZ compiler and linker to create your app - whatever it is you have and use
Once your solution or project is built, you have "artifacts" (build results, e.g. executable app, config files, etc.) lying around
with those results, you can do additional things:
zip them up into a ZIP file and copy them somewhere
run a install builder on them and create an MSI
install them on a test server to make sure everything installs just fine
The sky's the limit! :-)
But in general: Bamboo is just the "orchestrator" - the coordinator. The actual work is done by either direct Bamboo plugins (of which there are plenty), or then you can call external command-line apps by means of a unix script or Windows batch file.
Marc