[ https://issues.apache.org/jira/browse/MNG-8561?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Guillaume Nodet closed MNG-8561. -------------------------------- Resolution: Fixed > SourceRoot should be more lenient wrt duplicates > ------------------------------------------------ > > Key: MNG-8561 > URL: https://issues.apache.org/jira/browse/MNG-8561 > Project: Maven > Issue Type: Bug > Affects Versions: 4.0.0-rc-3 > Reporter: Guillaume Nodet > Assignee: Guillaume Nodet > Priority: Major > Fix For: 4.0.0-rc-3 > > > Maven 3 was supporting duplicate sources. > The Camel build now fails with: > {code:java} > Caused by: java.lang.IllegalArgumentException: Directory > src/generated/resources is specified twice for the scope "main" and language > "resources". > at > org.apache.maven.project.MavenProject.addSourceRoot(MavenProject.java:364) > at > org.apache.maven.project.MavenProject.addResource(MavenProject.java:790) > at > org.apache.maven.project.DefaultMavenProjectHelper.addResource(DefaultMavenProjectHelper.java:110) > at > org.apache.camel.maven.packaging.AbstractGeneratorMojo.addResourceDirectory(AbstractGeneratorMojo.java:112) > at > org.apache.camel.maven.packaging.PackageJaxbMojo.execute(PackageJaxbMojo.java:106) > at > org.apache.camel.maven.packaging.AbstractGeneratorMojo.execute(AbstractGeneratorMojo.java:108) > at > org.apache.camel.maven.packaging.AbstractGenerateMojo.invoke(AbstractGenerateMojo.java:104) > at > org.apache.camel.maven.packaging.AbstractGenerateMojo.invoke(AbstractGenerateMojo.java:82) > at > org.apache.camel.maven.packaging.GenerateMojo.doExecute(GenerateMojo.java:51) > at > org.apache.camel.maven.packaging.AbstractGenerateMojo.execute(AbstractGenerateMojo.java:70) > {code} > I think it can be easily avoided by checking if there's already the same > definition before calling {{{}addSourceRoot{}}}, however: > * I'm not sure this is really user friendly, maybe ignoring and warning if > the exact same source is added multiple times > * they key is too restrictive: it should perfectly valid to add the same > directory multiple times but with different includes/excludes, see > [https://github.com/jline/jline3/blob/3c634784c4c5cc8ea38a61e8585c18bad8fc6443/jline/pom.xml#L395-L422] > So I'm not sure about the {{record SourceKey(ProjectScope scope, Language > language, Path directory)}} ... > > [~desruisseaux] any thoughts ? -- This message was sent by Atlassian Jira (v8.20.10#820010)