[ http://jira.codehaus.org/browse/MNG-3999?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Brett Porter closed MNG-3999. ----------------------------- Assignee: Brett Porter Resolution: Won't Fix > validation of Id's too restrictive > ---------------------------------- > > Key: MNG-3999 > URL: http://jira.codehaus.org/browse/MNG-3999 > Project: Maven 2 > Issue Type: Improvement > Components: POM > Environment: xp, SAP NetWeaver, maven 2.x > Reporter: Sven Pressler > Assignee: Brett Porter > Attachments: pom.xml > > > I guess the validation of the Id's were introduced after issue MNG-801. > I think the validation is too strong. > The problem is that a lot of valid filenames are not validated as true. > The problem is caused by the DefaultModelValidator: private static final > String ID_REGEX = "[A-Za-z0-9_\\-.]+"; > This regular expression is far too restrictive since something like > "x=+%$ยง~!#^.jar" would be a valid filename on a windows operating system > I stumbled upon this because I'm developing tools for SAP NetWeaver, > currently we still use maven 1 to build our projects but we're in the process > of upgrading to maven 2. > maven 1 doesn't have this problem, since Id's didn't get validated like that. > Problem is SAP have a lot of libraries that have '~' in their names, like > 'tc~epbc~pcm~adminapi~java-5.x.y.jar'. Doesn't look any good, I don't like > it, I didn't make it like that but I have to work with it. > Maybe someone can explain why it's a good idea to be that restrictive about > the Ids, but as far as I see it, it's more like: before MNG-801 there was no > validation, and after MNG-801 there was some validation, and until now, there > was not too much complaining about it. > Attached is a pom which produces the following when trying to run mvn install: > Project ID: group:com~company~my~project > Validation Messages: > [0] 'artifactId' with value 'com~company~my~project' does not match a > valid id pattern. > Reason: Failed to validate POM for project group:com~company~my~project at > C:\test\validate\pom.xml > [INFO] > ------------------------------------------------------------------------ > [INFO] Trace > org.apache.maven.reactor.MavenExecutionException: Failed to validate POM for > project group:com~company~my~project at C:\test\validate\pom.xml > at org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java:378) > at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:292) > at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129) > at org.apache.maven.cli.MavenCli.main(MavenCli.java:287) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) > at java.lang.reflect.Method.invoke(Method.java:324) > at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315) > at org.codehaus.classworlds.Launcher.launch(Launcher.java:255) > at > org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430) > at org.codehaus.classworlds.Launcher.main(Launcher.java:375) > Caused by: org.apache.maven.project.InvalidProjectModelException: Failed to > validate POM for project group:com~company~my~project at > C:\test\validate\pom.xml > at > org.apache.maven.project.DefaultMavenProjectBuilder.processProjectLogic(DefaultMavenProjectBuilder.java:1108) > at > org.apache.maven.project.DefaultMavenProjectBuilder.buildInternal(DefaultMavenProjectBuilder.java:878) > at > org.apache.maven.project.DefaultMavenProjectBuilder.buildFromSourceFileInternal(DefaultMavenProjectBuilder.java:506) > at > org.apache.maven.project.DefaultMavenProjectBuilder.build(DefaultMavenProjectBuilder.java:198) > at org.apache.maven.DefaultMaven.getProject(DefaultMaven.java:583) > at > org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:461) > at org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java:365) > ... 11 more -- 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