MavenDefaultLayout implements RepositoryLayout { public URI getPath( Artifact artifact ) { StringBuilder path = new StringBuilder( 128 ); path.append( artifact.getGroupId().replace( '.', '/' ) ).append( '/' ); path.append( artifact.getArtifactId() ).append( '/' ); path.append( artifact.getBaseVersion() ).append( '/' ); path.append( artifact.getArtifactId() ).append( '-' ).append( artifact.getVersion() ); if ( artifact.getClassifier().length() > 0 ) { path.append( '-' ).append( artifact.getClassifier() ); } if ( artifact.getExtension().length() > 0 ) { path.append( '.' ).append( artifact.getExtension() ); } return toUri( path.toString() ); }  URI getPath( Artifact artifact ); URI getPath( Metadata metadata );  }
@Test public void testArtifactPath() { MavenDefaultLayout layout = new MavenDefaultLayout(); URI uri = layout.getPath( new StubArtifact( "g.i.d", "a-i.d", "cls", "ext", "1.0" ) ); assertEquals( "g/i/d/a-i.d/1.0/a-i.d-1.0-cls.ext", uri.getPath() ); uri = layout.getPath( new StubArtifact( "g.i.d", "aid", "", "ext", "1.0" ) ); assertEquals( "g/i/d/aid/1.0/aid-1.0.ext", uri.getPath() ); uri = layout.getPath( new StubArtifact( "g.i.d", "aid", "", "", "1.0" ) ); assertEquals( "g/i/d/aid/1.0/aid-1.0", uri.getPath() ); }