Issue Details (XML | Word | Printable)

Key: MAVEN-1410
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Lukas Theussl
Reporter: Dennis Lundberg
Votes: 1
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Maven 1

pom.artifactId is missing from XML schema and pom.id should be removed

Created: 30/Jul/04 04:06 PM   Updated: 18/Aug/06 04:53 PM   Resolved: 18/Aug/06 04:53 PM
Component/s: model
Affects Version/s: 1.0
Fix Version/s: 1.1-rc1

Time Tracking:
Not Specified

File Attachments: 1. Text File maven-project-3.xsd.patch (0.8 kB)
2. Text File maven-project.xsd-1_0-BRANCH.patch (0.8 kB)
3. Text File xdocs-artifactId-version2.patch (9 kB)
4. Text File xdocs-artifactId.patch (32 kB)

Issue Links:
Related
 


 Description  « Hide

After some discussion on the dev-list "pom.id versus pom.artifactId - which is correct?" there seems to be some inconsistencies in the 1.0 release.

The discussion resulted in the following conclusions:
1. The element project.id should be removed from the XML schema
2. The element project.artifactId should be added to the XML schema
3. Documentation needs to be updated to reflect the above issues

1 and 2 should probably be done by one of the core developers, including decisions regarding version numbers for the XML schema. I can make a patch for it if you think that's ok.

I can make patches for the xdocs to fix 3. On which branch should I create the patches?



Peter Nabbefeld added a comment - 02/Aug/04 07:09 AM

Please do not change the schema for POM-3. Please only update the documentation. Otherwise existent projects may break (my will, as I've had problems with the POM, found the schema and corrected my POMs to contain id instead of artifactId. However, there are inconsistencies I know about: ${pom.id} returns groupId:artifactId, while ${pom.artifactId} returns the id. IMO it would be better to release POM-4, so projects can be moved to this. Please provide a doc then, how to move, or - better - provide a tool/plugin for this move.


dion gillard added a comment - 02/Aug/04 07:40 AM

"1. The element project.id should be removed from the XML schema"
id is a valid element in POM3. It's deprecated and shouldn't be removed.

2. The element project.artifactId should be added to the XML schema
agree.

3. Documentation needs to be updated to reflect the above issues
Yep.


Dennis Lundberg added a comment - 02/Aug/04 06:18 PM

1. OK, it stays in POM3.

2. To add "artifactId" and still keep "id" we should probably use a "choice" in the XML schema. See attached patch for an example of how this can be done.

3. I will start writing documentation patches for the HEAD branch, unless someone objects.


Dennis Lundberg added a comment - 02/Aug/04 07:46 PM

Documentation patches for the HEAD branch.

Changelog:
1. I have replaced all occurances of "id" and replaced them with "artifactId", except in xdocs/reference/project-descriptor.xml.
2. Added a section for "artifactId" in xdocs/reference/project-descriptor.xml.
3. Put notes on the deprecated elements in xdocs/reference/project-descriptor.xml so that you can clearly see which elements are deprecated.


Brett Porter added a comment - 03/Aug/04 10:24 AM

Thanks - looks good. Could you possibly redo the HEAD patch without the whitespace changes? diff -wb I think.

The XSD change should be applied to MAVEN-1_0-BRANCH as well on the maven-project.xsd file.


Dennis Lundberg added a comment - 03/Aug/04 02:32 PM

Oops! An IDE that eats whitespace at the end of lines and a diff-tool with the "Ignore differences in whitespace"-checkbox checked is a dangerous combination

A new version of the documentation patches is attached.


Dennis Lundberg added a comment - 03/Aug/04 02:47 PM

Added a patch for the XSD for MAVEN-1_0-BRANCH.


dion gillard added a comment - 03/Aug/04 09:33 PM

Does maven scm:cvs-create-patch create a correct patch file, or does that goal need changing to handle whitespace?


Dennis Lundberg added a comment - 04/Aug/04 03:30 AM

I wouldn't know that. The patches I have made so far have been made using command-line CVS. Next time I will try to use the scm-plugin.


Dennis Lundberg added a comment - 07/Aug/04 07:22 PM

Running:
maven scm:cvs-create-patch
does not create a correct patch file. That goal need changing to handle whitespace. Opening a separate issue in the SCM plugin for that.


Brett Porter added a comment - 21/Sep/04 08:14 AM

in 1.1, an XSD, documentation and java code are all generated from one source, so should be a non-issue.


Dennis Lundberg added a comment - 21/Sep/04 03:48 PM

The new modello stuff sound neat. But don't you think that we should fix the XSD in maven-1_0-BRANCH?

The current (1.0) validation features built into Maven does not work. A perfectly valid pom (that uses artifactId instead of id) does not validate when you do "maven pom:validate". This is very confusing for new users.


Brett Porter added a comment - 21/Sep/04 04:45 PM

yes, I intend to copy the same schema to the 1_0 branch


Kristof Van Cleemput added a comment - 10/Feb/05 02:42 AM

Please adjust the xsd at http://maven.apache.org/xsd/ or put a new one with a higher version


Brett Porter added a comment - 24/May/05 09:21 AM

generating from model


Arnaud Heritier added a comment - 03/Aug/06 03:36 PM

The Id is always mandatory in the xsd..... and thus in the pom plugin


Lukas Theussl added a comment - 17/Aug/06 03:39 PM

Actually, the id element is only mandatory in stand-alone poms, ie in pom-strict-3.xsd, which is part of the pom plugin, so I think this issue can be regarded as superceded by MPPOM-6. We only need to review the documentation.


Dennis Lundberg added a comment - 18/Aug/06 02:06 PM

Let's see if I understand this correctly. If I use the latest trunk version of the pom plugin I will be able to validate a project.xml file that has groupId and artifactId but no id element. Is that correct?


Lukas Theussl added a comment - 18/Aug/06 02:53 PM

That's correct. If you can confirm, I think we can close this now as I also updated the docs yesterday.


Dennis Lundberg added a comment - 18/Aug/06 04:06 PM

Here are my findings after testing this.

First I nuked my maven-1.0.2 installation and ${user.home}/.maven
Then I installed a fresh maven-1.0.2 without upgrading anything

Tried validating the project.xml for commons-logging after adding a project element (the long version) with namespace, as given on the validation page on the plugin's site. It complained that the pom was missing the id element.

Installed maven-pom-plugin-1.5.1-SNAPSHOT from source
Tried validating again

BUILD FAILED
File...... C:\Documents and Settings\dlg01\.maven\cache\maven-pom-plugin-1.5\plugin.jelly
Element... assert:assertPluginAvailable
Line...... 69
Column.... 42
java.lang.NullPointerException

After a while I figured out that I needed plugin-plugin-1.7. That should be noted somewhere on the site. A better error message would be nice too...

Installed maven-plugin-plugin-1.7
Tried validating again

Using xsd file: C:\Documents and Settings\dlg01\.maven\cache\maven-pom-plugin-1.5.1-SNAPSHOT\plugin-resources/xsd/pom-strict-3.xsd
    ERROR on line 20 of file project.xml,
    XPath location /project:
    namespace URI of tag "project" is wrong. It must be "http://maven.apache.org/POM/3.0.0"
G:\apache\jakarta\commons-logging\project.xml is NOT valid!
BUILD SUCCESSFUL

I double and tripple checked the project element and the url and they are the same as the ones that are described in the validation.xml document.

I don't know if the BUILD SUCCESSFUL indicates that the validation succeded or not.


Lukas Theussl added a comment - 18/Aug/06 04:20 PM

The plugin-plugin-1.7 is indicated here: http://maven.apache.org/maven-1.x/plugins/pom/goals.html. Please read http://maven.apache.org/maven-1.x/plugins/pom/validation.html (note however that's it's not up to date anymore), you still have to indicate the namespace in the project root element. BUILD SUCCESSFUL does not mean that the pom is valid, only that the validation procedure succeded.


Dennis Lundberg added a comment - 18/Aug/06 04:28 PM

I missed the documentation on goals page for plugin-plugin, so that's OK.

Gaaaa! it's time for me to go to bed now. I was validating in the wrong directory! Too many versions of commons-logging checked out...

Validating in the correct directory produced this satisfactory output:

Using xsd file: C:\Documents and Settings\dlg01\.maven\cache\maven-pom-plugin-1.5.1-SNAPSHOT\plugin-resources/xsd/pom-strict-3.xsd
G:\apache\jakarta\jakarta-commons\logging\project.xml verified: OK
BUILD SUCCESSFUL