Install any jar manually into Maven repository

mvn install:install-file -DlocalRepositoryPath=local-repo -DcreateChecksum=true -Dpackaging=jar -Dfile=[your-jar] -DgroupId=[...] -DartifactId=[...] -Dversion=[...]
local-repo can be an additional repository (inside and exclusive) for a specific project or can be the default repository, which is ~/.m2/repository.

release jar’s using maven that can be used as OSGi bundles as well

Once
  1. Configure your jar plugin to include an OSGi compatible MANIFEST.MF file:
    
    
    
    org.codehaus.mojo
    build-helper-maven-plugin
    1.9.1
    
    
    set-osgi-version
    verify
    
    parse-version
    
    
    
    regex-property
    verify
    
    regex-property
    
    
    hans
    ${parsedVersion.osgiVersion}
    SNAPSHOT
    qualifier
    false
    
    
    
    
    
    org.apache.maven.plugins
    maven-jar-plugin
    2.3.2
    
    
    
    ${parsedVersion.osgiVersion}
    ${project.description}
    ${project.version}
    
    META-INF/MANIFEST.MF
    
    
    
    
    org.apache.maven.plugins
    maven-source-plugin
    2.4
    
    
    attach-sources
    verify
    
    jar
    
    
    
    
    
    
    2
    ${project.name}
    ${project.description}
    ${project.groupId}.${project.artifactId}.source
    ${project.organization.name}
    ${hans}
    ${project.groupId}.${project.artifactId};version="${hans}";roots:="."
    
    
    
    
    
    
Every release
  1. Commit all your changes.
  2. Adapt pom.xml to match the new version plus -SNAPSHOT string.
  3. Adapt MANIFEST.MF to match the new version omitting -SNAPSHOT string or .qualifer string respectively. Example:
    Manifest-Version: 1.0
    Bundle-ManifestVersion: 2
    Bundle-RequiredExecutionEnvironment: J2SE-1.5
    [..]
    Bundle-Version: 1.0.0
    [..]
  4. Make sure all your exported packages match the new version. Example:
    [..]
    Bundle-Version: 1.0.0
    Export-Package: net.sf.my.tools;version="1.0.0",
     net.sf.my.tools.async;version="1.0.0",
     net.sf.my.tools.comparator;version="1.0.0",
    Import-Package: org.junit;resolution:=optional,
     org.slf4j
    
    Again no .qualifier string!
  5. Perform your release as usual:
    user@client:~$ mvn clean release-prepare
    user@client:~$ mvn release-perform
    
  6. During the release, Maven will update the artifact version to the next iteration, e.g. 1.0.1-SNAPSHOT. This is done automatically but affects only the pom.xml. You have to adapt MANIFEST.MF manually to reflect the new version. This time, take over the Maven version string as given (replacing -SNAPSHOT with .qualifer). Example:
    Manifest-Version: 1.0
    Bundle-ManifestVersion: 2
    Bundle-RequiredExecutionEnvironment: J2SE-1.5
    [..]
    Bundle-Version: 1.0.1.qualifier
    [..]
  7. Again, make sure all your exported packages match the new version. Example:
    [..]
    Bundle-Version: 1.0.0
    Export-Package: net.sf.my.tools;version="1.0.1.qualifier",
     net.sf.my.tools.async;version="1.0.1.qualifier",
     net.sf.my.tools.comparator;version="1.0.1.qualifier",
    Import-Package: org.junit;resolution:=optional,
     org.slf4j
    
    This time include the .qualifier string.
  8. Done!
Known bugs and limitations:
  1. When you add this p2-repository to an Eclipse Target Platform, Eclipse will not correctly distinguish between artifact and source artifact.
  2. It is not very convenient to adapt the OSGi versions manually before and after each release. A shell script or Maven plugin may help here.