Suppose you have 2 projects in the same Eclipse workspace. I'll call them project1 and project2.
project1 is in 1.0.0 version;
project2 is in 1.2.0 version;
project1 has project2 as its dependency;
project2 isn't a child of project1.
What I'm trying to achieve is:
I want to update the project2 version to 1.3.0 (for example), and update the dependency version in project1 to reference the new version of project2. Is there any automated way to do that with Maven/Eclipse or I'll have to do manually?
I think there is no direct way with Maven. However I would try a different approach:
project1 writes its version number in a properties file, something like project1.version = 1.0.0. This can be easily done using filtering.
project2 reads the properties using the properties-maven-plugin and the dependency to project1 uses something like <version>project1.version</version>.
However I find this approach strange. I think that your two projects are very close and should be sharing a parent pom and have the same version, or you should handle this manually, because a version update is never trivial and should be done with caution (and testing).
Related
i have a scala js sbt project, i developped in this project new user interface components.
the person p1 has a project with the same structure (same build.properties & plugins.sbt), how can he access to my user interface components.
Should i add some specification in build.sbt ?
If you want to share some project settings, you can create a sbt plugin - it will allow you to have some common settings, add dependencies to other sbt plugins and even override their configuration. See for example sbt-softwaremill as a example of plugin that is used to share some commons between projects.
It won't magically update all configs, because:
build.properties is evaluated before the sbt code is run
you have to add this plugin to plugins.sbt
you have to create project structure in each project
Any more config sharing than that is theoretically possible by e.g. using git submodules and commiting symlinks to repo, but that would be pretty wrong - any change to one project would result in a change in another project, and you have them separated for a reason - if both projects were the same you would have one project in the first place.
And if you are need to share the code itself, you can build the code, publish it to an artifactory and add dependency in another project.
But that's only if you really have two projects, and it's entirely possible that you just need to have one git project with different branches, where ever developer would work on their own branch and then merge changes to common branch, bacause that's the point of using git.
I'm working with Eclipse (assume the latest version) and the Subversive SVN plugin. My SVN structure is the typical one:
branches
docs
...
tags
trunk
scripts
project1
src...
pom.xml
project2
...
I have checked out the whole structure using TortoiseSVN, and have imported in Eclipse project1, project2, etc. So when I want to commit or download code changes, I just do it from Eclipse. If I want to do the same with the documents or SQL scripts (which are outside the projects), I have to use TortoiseSVN instead. The problem is, TortoiseSVN and Subclipse don't work well together.
If I want to have those folders inside Eclipse to manage them with Subversive... how should I do it? Surely there has to be a better way than creating an empty "general" project, right?
I have a maven project, which will produce a jar file, and I want to use it in another sbt project. Is there any method to publish the jar file to .ivy rather than in .m2?
I try to put the jar file in the libs under the sbt project, but it does not work. and use the mvn install the jar to the .m2 does not work too.
As I understand it you have a maven project and an SBT project. The SBT project depends on the artifact produced by your maven project.
You ask how to publish the maven produced artifact to your local .ivy so it can be picked up by the SBT project.
you can probably achieve that using an ant task in the maven build.
However I'd like to suggest different angles :
Make the sbt project aware of the local .m2
Simply add resolvers += Resolver.mavenLocal to your sbt build definition, if you don't want to pollute the main build definition, add that line to a local.sbt file alongside the main build defition. SBT merges all the .sbt files found at the project root.
Publish to a controlled repository
This is especially useful if you want the build to be easily reproduceable outside of your local machine.
The idea is simply to publish the maven project to an actual server, either an internal nexus/artifactory server for proprietary code or to a public artefact hosting (such as bintray)
I use bintray all the time to publish custom builds of opensource projects while I wait for PRs to be merged in master and published an the official build.
Add your artifact server as a resolver to the SBT project and you are good to go :)
I have multi module project and using Build.scala to build. I am using nexus repository to publish.
Project structure is like
NLP
Core
Project1
Project2
Now say Project1 depends on Core and Project2 depends on Core and Project1 and lastly main project has dependency on all these jars.
When I do publishTo nlp.jar and pom.xml gets published to repository
I also would like to publish jars from other projects as well so those are available to consumer project. However somehow I am able to publish only nlp.jar and other projects jar and pom files are not getting published.
I tried to even look at following link however that did not help.
publish jar files with sbt (3rd party)
Thanks for help in advance.
I'm using Eclipse Helios and EGit 0.11.3.
I have a project where different branches use different versions of some of the libraries on my Java build path. For example, branch_old uses foo_lib_v1.0.jar while branch_new uses foo_lib_v2.0.jar.
If I'm working on branch_new and I need to checkout branch_old to test something, it's a bit of a hassle: I must manually reconfigure the build path in Eclipse before the project can build successfully.
Is there a way to store Eclipse's Java build path configuration for my project in git, so that when I check out a branch the build path is automatically modified? If not, is there another way to achieve the same result?
Thanks.
I see several choices here:
store project files (.classpath and .project) in Git as part of your branch. This way you would have to store all your dependencies in Git too, which is a hassle if you have a lot of them.
use Maven (m2eclipse plugin) and store project definition (pom.xml) file as part of your version control. Maven will greatly simplify your project dependency configuration
More information on m2eclipse plugin can be found at http://www.sonatype.com/books/m2eclipse-book/reference/
Should work: Put the .buildpath under version control. So its checkouted every time you switch the branches.
AFAIK Eclipse stores his build classpath in a file like .classpath(?) You can just add the file to git and have an own config for each branch.
Define several user libraries in your workspace, such as FooLib1, FooLib2, FooLib2. Then in the project's build path at a given branch reference the appropriate version of the library. Make sure you include project metadata files such as .classpath in your git repository and you should be set.