import com.crsn.maven.utils.osgirepo.osgi.OsgiRepository;
public class OsgiToMavenMapper {
public static MavenRepository createRepository( OsgiRepository repository ) {
MavenRepositoryBuilder builder = new MavenRepositoryBuilder();
for( OsgiBundle plugin : repository.getPlugins() ) {
String groupId = createGroupId( plugin.getName() );
String artifactId = createArtifactName( plugin.getName() );
Version version = plugin.getVersion();
boolean isSourcePlugin = plugin.getName().endsWith( "source" );
MavenArtifactBuilder artefactBuilder = isSourcePlugin
? builder.addSourceArtifact()
: builder.addArtifact();
artefactBuilder.setGroup( groupId );
artefactBuilder.setArtifactId( artifactId );
artefactBuilder.setVersion( createMavenVersion( version ) );
artefactBuilder.setContent( plugin.getLocation() );
addDependencies( repository, plugin, artefactBuilder );
}
return builder.build();
}