[ http://jira.codehaus.org/browse/MNG-3375?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=164131#action_164131 ]
Torben S. Giesselmann commented on MNG-3375: -------------------------------------------- BTW: I didn't really manage to write a test, because testing the function involved would require a fully configured / working {{PlexusContainer}} and, quite frankly, I ran into some problems. ;-) Someone more experienced than me should be able to construct a working test. Here's what my current test would look like, maybe someone can make some use of it: {code} public void testShouldNotAllowDuplicateRepositoryIds() { Repository repo1 = new Repository(); repo1.setId( "first" ); repo1.setUrl("non-empty-url"); repo1.setLayout("default"); Repository repo2 = new Repository(); repo2.setId( "second" ); repo2.setUrl("non-empty-url"); repo2.setLayout("default"); Repository dupeRepo = new Repository(); dupeRepo.setId( "second" ); dupeRepo.setUrl("non-empty-url"); dupeRepo.setLayout("default"); List repoList = new ArrayList(); repoList.add(repo1); repoList.add(repo2); DefaultPlexusContainer container = null; try { // TODO: initialize a working PlexusContainer ... // String basedir = System.getProperty( "basedir" ); // InputStream configurationStream = this.getClass().getClassLoader().getResourceAsStream( "PlexusContainerTest.xml" ); // container = new DefaultPlexusContainer(); // container.addContextValue( "basedir", basedir ); // container.addContextValue( "plexus.home", basedir + "/target/plexus-home" ); // container.setConfigurationResource( ReaderFactory.newXmlReader( configurationStream ) ); // container.initialize(); // container.start(); ProjectUtils.buildArtifactRepositories( repoList, new DefaultArtifactRepositoryFactory(), container ); } catch ( InvalidRepositoryException e ) { fail( e.getMessage() ); } // MNG-3375: exception should be thrown if two repository IDs are equal repoList.add(dupeRepo); try { ProjectUtils.buildArtifactRepositories( repoList, new DefaultArtifactRepositoryFactory(), container ); fail(); } catch ( InvalidRepositoryException e ) { // exception should be thrown } } {code} > Repository entries with same id are ignored > ------------------------------------------- > > Key: MNG-3375 > URL: http://jira.codehaus.org/browse/MNG-3375 > Project: Maven 2 > Issue Type: Bug > Components: Artifacts and Repositories > Affects Versions: 2.0.8 > Reporter: Carlos Sanchez > Priority: Critical > Fix For: 2.0.11 > > Attachments: MNG-3375-maven-project.patch > > > If two <repository> entries have the same id one of them is ignored with no > warning or error. > IIRC this worked with previous versions of maven, giving the same id allowed > you to share the configuration in the settings.xml file (it may have been for > deployment only though) -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira