This may be an easy answer for you but I've been spending lot of my time changing the project versions. Here is my situation:
I have 8 java spring projects in my eclipse workspace. 5 projects depend on the 3 other libraries.If I change the versioning of any of the three projects [which is quite often], I need to change the versions all the 5 project pom.xml files. I found it very cumbersome. I tried changing the versioning of these 3 dependent projects to a constant value [e.g. latest], then my local set up is working fine but CI/CD doesn't change the next incremental version.
I'm pretty sure I'm not the only one who is facing this type of situation. Hoping someone can guide me on how to manage the versioning locally and in the CI/CD process.
Thank you for reading this!
1st solution: Put all eight projects into one multi-module project and build it together with the same version number
2nd solution: Do not change the versions so often, only if you publish everything as productive version to the outside world.
Related
Currently I'm in the transition of moving ANT projects to Maven and struggling on how to get the project versioning working correctly. Currently I have about 30+ projects/modules that all rely on each other so everything must be at the latest version to work correctly. This was easily done with ANT but when it comes to Maven I would need to make constant changes to all other released project POM's to allow them to pick up these new changes.
I discussed with a few other developers and we decided we might not even need a maven repo with version numbers, we just have everything at the same version number and build locally or through Jenkins to update our .m2 folders. Does this sound like the correct route for our situation? Are we missing anything doing this?
I did suggest having our test Jenkins to deploy to a repo with version numbers like 1.0.Beta-SNAPSHOT. We have Jenkins setup to build when our testing branches are updated. This means I would not have to locally compile every project on that branch to update my .m2, I could just change the POM to pull all these Beta-SNAPSHOT versions in one place. Would there be a good way for me to do this that would not affect the release if it was pushed and released with this version number set? If I wanted to use my local versions I would then just switch this version number to 1.0.0 which isn't within the repo but my local .m2.
Any suggestions on how to properly manage the maven projects/modules with version numbers would be welcome! Something that reduces the need to change every POM when releasing 1 of the projects/modules would be best!
Our developer struggle with this problem a lot. It is a lot of manual work to update all the POMs for a release.
We are going to aim for multi-module projects, which also seems like a good fit for you.
If you say, that everything must be using the latest versions all the time, I would put all the projects into one large multi-module project. This means that you have one (git) repository with a main POM in the root directory and a directory for each module (sub-project) with its own POM references the main POM as parent.
Then you can run mvn clean install on the parent and build all the modules with consistent version numbers. So releasing is then just one large build.
You should note, though, that you tie the projects (modules) closely together in this way, but it I understood you correctly, they are already tightly interrelated.
I have a project that is build using ant and now i am trying to convert into one that is build in eclipse.
The ant files describes different compiler versions for different course folders i.e few are compiled using jdk 5, few using 6 and still few using 4.
How can we configure the project in eclipse to use different compiler levels in eclipse for different folders in same project.
I noticed that they had this bug lined up in eclipse and they said to release it on 3.5 and i am using 4.3. So it think the feature should be there.
Such feature does not exist. You will need to create multiple Eclipse projects.
I would suggest that you think twice before making a change in that direction.
ANT might not be the best build tool, but switching to Eclipse is way worse as you tight yourself not only to an IDE, but also to a specific configuration of both your instance and your project, making it less portable and more fragile than before.
I would rather suggest that you split your project into different modules/projects and use maven (integration with Maven and Eclipse is ok for simple builds) to organize both you CLI and Eclipse build procedures.
I'm working on a large multi-module Maven-based system, with some 20 sub-modules and an additional small number of project-external dependencies that are also Maven projects in my Eclipse workspace. All in all, there are some 30 projects in the Eclipse workspace.
The projects are all imported maven projects with m2e, and we use Subversion (with Subversive plugin) for source control. Eclipse is a recently updated Kepler.
My workstation is quite capable, with 4-core Intel i7 CPU, 16 Gb RAM, and a solid-state disk.
The problem is that Eclipse is very slow when it comes to:
Team synchronize and conflict resolution. Each time I fix a conflict
and "Mark as merged", I have to wait 10-30 seconds for Eclipse to
refresh workspace etc. Not to mention that the conflict-mode tree
view then clears entirely, so I have to select outgoing mode then
conflict mode again to re-populate. Twice - because it clears when I
save the resolved source file, and then again when I mark as merged.
Building. I use Maven launch configurations to do Maven builds. But
for some reason, doing the Maven build is not enough for Eclipse -
it then has to do its own build too of the entire workspace, which
takes at least as long, and much longer when Eclipse decides to hang
a few minutes on 'Clearing output folder of project xxx', for
several of the projects.
The result of all this is that often it takes over an hour to update from source control, resolve conflicts, build and be ready to run or continue development.
Me and my co-workers often feel that Eclipse is hampering development, when it should be enhancing it.
Is there anything that can be done to reduce the eternal waiting-for-Eclipse syndrome?
We have this same problem.... 72 projects in our workspace normally makes using m2e impossible. We're trying to not use m2e and start maven executable as an external tool with some configurations. And you can make maven generate your .project and .classpath to change the eclipse configurations:
mvn eclipse:eclipse
Not the best option, but is what we have now.
Some good tips I'd suggest are:
Before you start importing large projects, go to Projects and uncheck Build Automatically
Import projects in the smallest sub-components you can. If the project is Mavenized, this means selecting the lowest pom.xml in the tree to import each time, rather than importing a large parent POM and all it's sub-projects.
When you are not working on (as in, modifying) the source code of a specific project, close it by right-clicking and going to Close Project. This will release resources for Eclipse to use elsewhere. If you still need to see the source code of something without modifying it (for debugging), you can add source containers as you need
Use different workspaces for different projects. Eventually it's quicker to have 2 working, fast versions of Eclipse than one huge slow one
If you can't split a project, you can also try to give Eclipse more memory, and make sure you're using JVM 8, for example
-Dosgi.requiredJavaVersion=1.8 -Xms512m -Xmx2g
It sounds like you're just dealing with something that's too large for most any IDE, but that may not be the case. If all else fails, why not try IntelliJ to see if that works better for you?
Guys I had the same problem but instead of using IDE's for brute force build can you analyze the design of those applications properly? I'm telling that because there are applications which don't have to be entirely build, you can deploy it separately and analyze it in modules. Most of times, there aren't reasons for keeping together thousands and thousands of classes, build it and keeping it together... the IDE's like Eclipse wasn't designed for such tasks but for local developments and the servers do the integration build, not the workstations.
Probably your design or your philosophy of continuous build are somewhat misunderstood.
Cya.
I'm working on a Maven based web project in Netbeans. The problem is, each time I build the app, it has the same version number in the war, e.g 'myProject-0.0.1.war`. When I deploy it to Amazon EBS I have to manually type in a new version label since it just puts in the name of the war as the version label.
Is there a way to get Netbeans to use an incrementing version number with each build, e.g 0.0.1, 0.0.2, or even just 'myproject-build1000.war', 'myproject-build10001.war' etc?
Although NetBeans is a very Maven-friendly application, the version numbers are very much a Maven thing - NetBeans doesn't have much to do with them.
There does appear to be a solution here:
https://code.google.com/p/autoincrement-versions-maven-plugin/
I've not tried it, but it seems to do what you want.
More generally, to really understand the reasoning behind version numbers in Maven, check out the maven release plugin. On a more practical note, the maven versions plugin is a very useful tool for modifying version numbers in poms.
We have several products which have a lot of shared code and which must be maintained several versions back.
To handle this we use a lot of Eclipse projects, some contain library jars, and some contain shared source code (in several projects to avoid getting a giant heap with numerous dependencies while being able to compile everything from scratch to ensure that source and binaries are consistent). We manage those with projectSet.psf's as these can directly pull all projects out from CVS and leave a fully prepared workspace. We do not do ant builds directly or use maven.
We now want to be able to put all these projects and their various versions in a Continous Integration tool - I like Hudson but this is just a matter of taste - which essentially means that we need to get an automatic way to check out the projects to a fresh workspace, and compile the source folders as described in the project-files in each project. Hudson does not provide such an approach to build a project, so I have been considering what the best way to approach this would be.
Ideas have been
Find or write an ant plugin/converter that understands projectSet.psf's and map to cvs-checkout and compile tags.
Create the build.xml files from within Eclipse and use those. I tried this, and found the result to be verbose and with absolute locations which is not good with automatic tools putting files where they want to.
Write a Hudson plugin which understands projectSet.psf's to derive a configuration and build it.
Just bite the bullet and manually create and update the CI configuration whenever stuff breaks - I don't like this :)
I'd really like to hear about other peoples experiences so I can decide how to approach this.
Edit: Another option might be using a CI which knows better about Eclipse projects and/or project sets. We are not religious - this is just a matter of getting stuff running without having to do everything ourselves. Would Cruise Control be a better option perhaps? Others?
Edit: Found that ant4eclipse has a "Team Project Set" facility. http://ant4eclipse.sourceforge.net/
Edit: Used the ant4eclipse and ant-contrib ant extensions to build a complete workspace as a sjgned runnable jar file similar to the Runnable Jar facility in Eclipse 3.5M6. I am still depending on Eclipse to create the initial empty workspace, and extract the ProjectSet, so that is the next hurdle.
Edit: Ended up with a dual configuration, namely that Hudson extracts the same set of modules as listed in the ProjectSet.pdf file from CVS (which needs to have the same tag) causing them to be located next to each other. Then ant4eclipse works well with the projectSet.psf file embedded in the main module. Caveat: Module list in Hudson must be manually updated, and it appears that a manual workspace cleanup is needed afterwards to let Hudson "discover" that there is more projects now than earlier. This has now worked well for us for a couple of months, but it was quite tedious to get everything working inside the ant file.
Edit: The "Use Team Projects" with ant4eclipse and a Ctrl-A, Ctrl-C in Project Panel with a Ctrl-V in the CVS projects in Hudson has turned out to work well enough for us to live with (for mature projects this is very rarely changed). I am awaiting the release of ant4eclipse 1.0 - http://www.ant4eclipse.org/, currently in milestone 2 - to see how much homegrown functionality can be replaced with ant4eclipse things.
Edit: ant4eclipse is as of 20100609 in M4 so the schedule at http://www.ant4eclipse.org/node?page=1 is slipping somewhat.
Edit: My conclusion after using our ant4eclipse approach for a longer period is that the build script get very gnarly and is hard to maintain. Also the Team ProjectSet facility (which ant4eclipse use to locate the projects) which works well for CVS based repositories, but not after we migrated to git (which is a big thing in itself). New projects will most likely be based on maven, as this has good support in Jenkins.
I'm not completely sure I understand the problem, but it sounds like the root issue is that you have many projects, some of which are dependent on others. Some of the projects that are closer to the "leaf" of the dependency tree need to be able to use "stable" (or previously "released") versions of the more "core" projects.
I solve exactly this problem using Hudson, ant, and ivy. I follow a pattern demonstrated by Clark in Pragmatic Project Automation (he doesn't demonstrate the dependency problems and solutions, and he uses CruiseControl rather than hudson.)
I have a hand-written ant build file (we call it "cc-build.xml", because of our CruiseControl roots.) This file is responsible for refreshing the working space for the project from the CM repository and labeling the contents for future reference. It then hands off control to another hand-written ant build file (build.xml) that is provided by each project's developers. This project is responsible for the traditional build steps (compile, packaging, etc.) It is required to spit out the installable artifacts, unit test reports, etc, to the Hudson artifacts directory. It is my experience that automatically generated build files (by Eclipse or other similar IDE's) will never get close to getting this sufficiently robust for use in a CI scenario.
Additionally, it uses ivy to resolve its own dependencies. Ivy supports precisely-specified dependency versions (e.g. "use version 1.1") and it supports "fuzzy versions" (e.g. "use version 1.1+" or "use the latest version in integration status.") Our projects typically start out specifying a very "fuzzy" version for internal projects under ongoing development, and as they get close to a release point, they "freeze" the dependency version so that stuff stops moving underneath them.
The non-leaf projects (projects that are dependents for other projects) also use ivy to publish their artifacts to our internal ivy repository. That repository keeps all past builds of the dependents, so that any project can always depend on any other previous version.
Lastly, each project in Hudson is configured to have a build trigger that causes a rebuild when any of its dependent projects successfully build. This causes them to get built again with the (possibly) new ivy dependent version.
It is worth noting that once you get this up and running, consistent automated "labeling" or "tagging" of an automated build's inputs is going to be critical for you - otherwise troubleshooting post-build problems is going to result in having to untangle a hornet's nest to find the original source.
Getting all of this setup for our environment took quite a bit of effort (primarily in setting up the ivy repository and ant build files,) but it has paid for itself many times over in saved headaches in manually managing the dependencies and decreased troubleshooting effort.
Write a Hudson plugin which
understands projectSet.psf's to derive
a configuration and build it.
That seems like the winning answer to me.
I work with CruiseControl rather than Hudson but in my experience if you can create a plugin that solves your problem it will quickly payoff. And it is generally pretty easy to write a plugin that is custom fit for your solution as opposed to one that needs to work for everyone in a similar situation.
I have tried both Cruise Control (CC) and Hudson for our CI solution. We (as a company) decided on Hudson. But for your question "Does CC support Eclipse project build" the answer is no as far as I know. CC supports many more different build tools and Source Control systems but it is a bit more difficult to configure and use. As for Hudson, it is more simple to configure and use it. We developed our custom plugins for both CC and Hudson for the parts of our build cycle that they do not provide as is. As for plugin development, if you know / use Maven, Hudson is simpler too. But if you are not familiar to Maven, first you need to learn the basic usage of maven to successfully develop a Hudson plugin. But once you understand the basic usage of maven, plugin development, test and even debug is simpler in Hudson.
For your specific problem, I can think of a solution that makes use of Eclipse plugins as well. You can develop your own Eclipse plugin that for instance gets the psf files from a (configurable) folder, and use Eclipse internals to process these psf's. I mean you can use existing Eclipse source codes that takes a psf file, check-outs it's project definitions and compile these projects. This Eclipse plugin of yours may have a preference page (which you can access by Eclipse -> Window -> Preferences) and configure which folder it will use to look for psf files. Your Eclipse plugin should also have a way to start psf processing without user interaction. For this, you can use ipc to trigger your process. I mean your Eclipse plugin can listen for a port, and you can write another java application that will connect to your plugin through this port and trigger its process. As for CI part, you can use either CC or Hudson and use their external process execution support. If you are using Windows, you can write a bat file (for Linux sh file) that first launchs Eclipse that has your plugin installed. Then it launches your java application that will communicate with your Eclipse plugin to trigger your process. From your CI tool you will need to run your bat / sh file to trigger your process.