The work on Automatic Injection/Binding for Guice is in heaviy progress. I added the possibility to use the JSR330 and/or Google Guice Annotations.
So you can create a Named-Binding due using the @Named-Annotation. Due the fact, that the Guice-Named Annotation is not able to annotate a Class, I only support the javax.inject.Named-Annotation.
If you annotate a Class with it, it will result in
To declare a Singleton you can use the @Singleton of the JSR330 and/or the Google Guice-Annotation.
binder.bind(interface).to(annotatedClass).in(Scopes.SINGLETON) /* for named resources */ binder.bind(interface).annotatedWith(Names.named(annotation.name())).to(annotatedClass).in(Scopes.SINGLETON)
After I submitted this feature, I want to release a new Version. So I added the Maven Release Plugin and tried to do “mvn release:prepare” and “mvn release:perform”.
What a big mistake. :)
- Windows 7
- Github Account
- git 1.7.x + msysgit
- Maven 2.2.x
I faced several problems. First of all I didn’t recognize, that I don’t had the distribution section, due the fact that the most Maven Repository are only working if you have a project there, I decided to use the Sonatype Repository.
I just can recommend to every github User which needs one, get your account there!
You create a Account, create a JIRA ticket and after one Day you can upload to OSS. The big advantage is, you can stage your releases. So release your version and if your think your are done, bring it from a Stage-Level to a Release and it wil be synched to Maven Central.
Have a look at the Usage Guide
After adding a “settings.xml” to my “~\.m2″ Folder, I also decided to encrypt it, because you have to store your Sonatype-Account Settings there.
How-to do it? Maven Encrypt Password
What I also can recommend is, that you create a Root-Project, which inherits from the Sonatype-POM. You need this step, because they already configured the plugins, which you need for you. Parent POM Settings
After this step you need to configure GPG. For releasing to Maven Central you have to sign your Releases and Snapshots. For me the easiest way was, to remove all gpg*.exe Files from my Git-Installation.
I installed a newer Version: gpg4win.
Nevertheless the easiest way (whatevery gpg you use) you should create a certificate and import it with gpg –import mycertificate.asc.
The problem with the Git gpg was, that it search for my certificates in ~\.gnupg. But I don’t have this directory. You can overwrite the directory with passing -Dgpg.homedir= when using mvn release:*.
All the problems I had are related to the Unix-Environment for Windows. Due the fact, that it uses Unix-Folder Path, but partly working with Windows-Paths Style, I had a lot of problems.
- Not finding POMs (your pom is outside of the repository
- StringIndexOutOfBoundsException when using the Release Plugin Version 2.0
How could I overcome these issues?
I’m working with git-bash, but the first thing I do is, type cmd. So you have your whole Environment, but working in Windows-Style.
If I’m working with git, I’m using the Bash-Style not the Windows one.
You also need the git-bash because I didn’t get it up and running to use the ssh-agent under Windows. But if you are starting the git-bash this will work, because it ask you while startup about your Passphrase. How-to start SSH-Agent
EDIT: The problems with Windows, Maven, msysgit is how you start your git-bash. Start your bash with the Help of the Windows Command. Doing it this way, the Letter is “F:” (or whatever :)). Starting directly the git-bash it is “f:”.
EDIT 2: When using the Command Line + Git-Bash, you should change to your local drive with “F:”. The major point is the Uppercase of the Letter!!! Without it, the Maven-Release-Plugin 2.0 will fail.
- Use -DautoVersionSubmodules=true if you have multiple Modules, but want just one Version Number
I hope my comments, can help you a little bit, while working with Maven, git/Github and Windows.
If you have questions, don’t hesitate to ask me. :)