I have a project with maven in java that I generate a package on github, but I need to generate a package for the develop branch and another for the master branch, both must be active and must be accessible?
Knowing how to generate two packages in the master and develop branches
Related
My team uses a GitHub.com organization to keep all of our source code in private repos. (Prior, our old workflow was emailing Dropbox links). Most of the time each repo is one separate project with no dependancy of any other (the only dependancies are on third-party open source libraries). Or if there is some dependancy, then the .java files have just been copy pasted into the other project.
I've recently been splitting up some of my code into reusable modules, but I don't know any way to do the dependancy management when I use the libraries I'm creating in another project.
I know with Gradle you can add a git repo like this:
gitRepository('https://github.com/user/project.git') {
producesModule('user:project')
}
but I don't know if there's a way to make it work with private repos, and I don't know if there's a way to specify versions.
My currently solution is to just build the library JAR, and keep track of the binary version with GitHub release tagging, and when I need to use the library in another project, I download the desired version of the JAR (typically the most recent) and add it to a local /lib/ folder in the other project and import the JAR into the module path as a local JAR. Of course I need to go through the whole process again manually if I want to make a change to the library.
I also heard you can set up private Gradle or Maven servers and some companies do that, but I guess that would mean migrating away from GitHub.com?
Is there any way to make this work (either Gradle or Maven, it doesn't matter) to manage dependancies between GitHub private repos?
Can someone tell me, what is the most sensible way (or ways) to solve this?
Thanks.
What you need is a very typical maven/gradle based setup where
each of your projects will be producing an artifact with a coordinate
of the form group:name:version
your projects do not have to be explicitly aware of each other. They depend on the artifacts produced by other projects. This is called binary dependency
for a project to locate a binary dependency, you will need a central registry where you can publish all your artifacts to. GitHub has a product called GitHub Package for precisely this purpose.
If you don't want to use GitHub Package yet, or your setup (number of projects, size of each projects, size your team) is small enough, you can locally checkout all the projects and include them into a gradle composite build so that binary dependencies will be substituted with local project dependencies. The good thing about the composite build is that when you decide to invest in a package registry, your build.gradle requires no change at all.
BTW, where you run your private package registry does not really matter. You can use the GitHub Package, or some other hosted services, or even run e.g. jfrog artifactory on your own server. It is completely unrelated to where you host your source code, so you dont need to migrate away from GitHub in any case.
I've a maven multi module project in following structure. Our project is in GitHub corporate page.
I'm planning to make one of the maven module project public to let it be open source. However, because of maven multi-module project structure it needs to be under parent project hierarchy in file system, isn't it ?
What I want to do is creating a separate repository for publicModule2 and pushing it to public repo. It'll be an open source project. The rest will remain the same. Is there any way doing it without breaking maven multi module project structure ?
-- Maven parent project
-- commonsModule
--cusomModule1
--cusomModuleN
--publicModule2
P.S.As you know when you remove it from modules they're not compiling together each time and I don't want this. Without module structure I already separated another project but I don't look for that for this project. Please consider this in your reply
If you are serious about making it open source, that includes giving people an easy, reproducible way to build it. If it is required to be built as part of a larger project which they don't have access to, they won't be able to do that.
What you are looking for is possible with Git submodules. You would need to make the public one a submodule of the original parent.
From the docs, this feature is to be used when
you want to be able to treat the two projects as separate yet still be
able to use one from within the other.
However I would strongly advocate separating the projects so that the public one can be built independently.
My application has 4 Java packages.
com.me.utilities
com.me.widget
com.me.analysis
com.me.interface
All packages depend upon the utilities. The widget package depends upon the interface package.
The utilities might be valuable to other applications so it ought to be a package of its own. The analysis does not depend upon the widget and the interface so analysis ought to be a package of its own. The interface might change because the organization that it interfaces to might go out of business so the interface ought to be a package of its own.
This is just one application that produces one executable.
On the basis of this organization I do commits on each package but not on the executable. I want to start to commit the executable. One way would be to commit the executable in a new git archive without any connection to the source but that sounds reckless to have an executable and no formal way to tie it to source code.
Another way, which sounds a little inefficient, would be to simply start a new git archive that "adds" the source code of all 4 Java packages, each of which has many Java files, and also "add" the executable. This seems a little strange because it fails to respect the 4 existing git archives that already know about their respective collections of source code.
What is the right way to tie these 4 packages together with their common executable?
I use SmartGit for routine commits and I use command line git for reverting. I am willing to stop using SmartGit if the solution to this inquiry necessitates it.
It looks like what you're looking for is an artifact repository, like Nexus, Artifactory, JCenter, etc.
That's where you typically publish the artifacts produced by a build every time you do a release.
That's also what allows build tools and IDEs to get artifacts for the libraries a project uses. So if you end up turning your utilities package into a separate library, used by several different projects, you'll need to publish it in such an artifact repository. Both Gradle and Maven get their artifacts, but also allow publishing artifacts, to such artifact repositories.
I have almost no experience in using netbeans and svn so please correct me gently if I am wrong. I come from using python/vim/git so workflow wise is foreign to me.
Currently, I used the Netbeans' svn plugin to checkout my project from a remote repository. The project has several components like webservices, and also a swing client and of the business logics.
Assuming that I need to work with the web services and the swing client, do I create separate projects for each, and import the project as references?
Finally, currently I'm using netbeans to test the webapp on the local glassfish server. How do I deploy on a remote test server so that my team mates can use and test the web app?
If all of the seperate components are a part of the same project in svn then, no, you should only create one project in netbeans. Check out the project from svn and once netbeans has checked out the project it should prompt you to create a netbeans project when it does select project from existing sources, follow the wizard steps and your project will be created. You will have to import any external jars needed by the project that has been checked out into the newly created project in netbeans. NOTE: Netbenas will create a build.xml file for the newly created project so be sure that you do not commit that build.xml file into the repository unless it's needed.
To setup a remote server in netbeans go to tools->servers, select add server, select the server type(glassfish, tomcat, etc) then enter the pertinent information for the server using the wizard.
First question "Assuming that I need to work with the web services and the swing client, do I create separate projects for each, and import the project as references?"
It really depends on your architecture - how coupled are those components. It's also important what packaging system do you use? For example if you use Maven you can easily modulate the project and define dependencies between the modules. Check out this for details. I am referring to maven as it's build-in in Netbeans.
Regarding your testing you basically have 2 options:
a) expose your glassfish to your buddies
b) package and deploy your project remotely - this really cannot be given straight answer - depends on your infrastructure, where's the remote server, how big the deployment package is, how the application server behaves regarding hot deployments etc.
I suggest try the first option.
SVN helps you to keep the project in several versions in the repository.
You can always checkout from repository.
once you checked out, you will be using the project from a saved directory somewhere in your local machine.
Now, you can keep on developing the project, at the same time your friends can also keep doing that, and whenever you think you have done enough changes or development then after verifying your own copy of the project, you can commit the changes to repository.
After committing the changes will be visible in the repository to everyone, and hence anyone can access this updated version of the project residing in the repository.
Note that the earlier version will not be deleted, unless you do so.
Your friend can also checkout a copy of the project from the repository and they can merge it with their existing ones, and they can also commit the changes.
and at the same time, you can ask your friend to check your developed code by checking out the project and deploying on their local server.
I hope it gives you a better picture.
I come from the .NET world, so I will ask in .NET terms in order to understand what is the java-world terms. I have experience with java.
I need to create asolution with two projects: library project and web application.
The library project uses hibernate and the web application should have reference to the library application.
I am using intellij and I saw there are various things like project and module. I don't know this terminology - can anyone explain me what king of 'projects' I need?
I saw that if I create a new project while working on project it opens a new window.
While I add a new module it adds the module project in the big project.
The terminology is IntelliJ's rather than a Java standard. (Other IDEs use similar terminology)
There is not much more to projects and modules than you have realised already. A single projects which is opened at once contains several modules which break up your work logically. A single modules can appear in multiple projects, but this can be more confusing than useful.
You can have one project with one module which is the simplest way to start.
You may want to look at using maven as this a portable way to manage your dependencies and build your project (all IDEs support maven and it can be run stand alone)
Even though I am a heavy IntelliJ IDEA user I always start from maven project, which I then import to IDE.
In maven you create one parent project (with pom packaging) and two submodules: one with war packaging and dependent one with jar (default). After importing you'll see two modules in IntelliJ.