You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bu...@apache.org on 2010/04/21 12:15:01 UTC
DO NOT REPLY [Bug 49162] New: incorrect duplicated project name
warning when imports from URL-providing resource
https://issues.apache.org/bugzilla/show_bug.cgi?id=49162
Summary: incorrect duplicated project name warning when imports
from URL-providing resource
Product: Ant
Version: 1.8.0
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: Core tasks
AssignedTo: notifications@ant.apache.org
ReportedBy: aoxiaojian@gmail.com
I'am interesting in the new feature comes from ant 1.8.0:
"<import> can now import from any file- or URL-providing resource - this
includes <javaresource>."
Yesteday I had a try to import URL-providing ant xml file, I had some ant build
files like this :
-root of product
- commom/
+ common.xml
+ ivy.xml
+ publish.xml
- project1
+ build.xml
- project2
+ build.xml
The build.xml files in project1/2/3/4... import the common.xml file, and
common.xml file imports all other xml files in common directory. This is very
common for multiple projects to share the common build targets.
These ant build file work well when I use normal file import. But when I move
common directory and all the ant xml file to a jar and then in
project1/2/3/4... import this common.xml as URL-providing resource. These ant
builf file work well except a warnning in ant log:
"Duplicated project name in import. Project *** defined first in **** and again
in null"
I'm sure that all the project name are not Duplicated.
And this warning will only appear in this specifical case: using <buildlist> to
get a build files list of project1/2/3/4... and then execute the target in
each build file. If only one project's build.xml, this warning would not
happen.
I have download the source code of ant 1.8 and found the reason of this
warning:
1. in org.apache.tools.ant.helper.ProjectHelper2
if (context.isIgnoringProjectTag() &&
!dupFile.equals(context.getBuildFile())) {
project.log("Duplicated project name in import. Project "
+ context.getCurrentProjectName() + " defined first
in " + dup
+ " and again in " + context.getBuildFile(),
Project.MSG_WARN);
}
Compare to the warning log "and again in null", we can know that
context.getBuildFile() would return null. In this case,
!dupFile.equals(context.getBuildFile()) would always return true and cause the
incorrect warning.
2. in org.apache.tools.ant.helper.AntXMLContext
public void setBuildFile(File buildFile) {
this.buildFile = buildFile;
......
}
/**
* @since Ant 1.8.0
*/
public void setBuildFile(URL buildFile) throws MalformedURLException {
this.buildFileURL = buildFile;
........
}
public File getBuildFile() {
return buildFile;
}
Now we can see that if we use URL import, the setBuildFile(URL buildFile)
method will be invoked but it will set attibute buildFileURL, not attibute
buildFile, so the method getBuildFile() will always return null.
I think this would be a bug, the check logic for duplicated project name
would be updated for the new fearture URL-providing import added in ant 1.8.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
DO NOT REPLY [Bug 49162] incorrect duplicated project name warning
when imports from URL-providing resource
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49162
Stefan Bodewig <bo...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
--- Comment #2 from Stefan Bodewig <bo...@apache.org> 2010-05-04 08:14:30 EDT ---
1.8.1 is about to be released soon. In fact the archives that will make up
the release are currently voted on and can be found at
http://people.apache.org/~antoine/dist/
It would be great if you could give it a try before we announce the final
release - we may be able to delay the release if the problem still persists.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
DO NOT REPLY [Bug 49162] incorrect duplicated project name warning
when imports from URL-providing resource
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49162
--- Comment #3 from Sky Ao <ao...@gmail.com> 2010-05-09 07:36:24 EDT ---
I have verified this bug with new version 1.8.1, this warning doesn't appear
now.
Also I have checked the source code of class org.apache.tools.ant.helper
ProjectHelper2, the code above in my bug report has been updated to add check
for both context.getBuildFileURL() and context.getBuildFile():
if (MagicNames.ANT_FILE_TYPE_URL.equals(dupType)) {
...
contextFile = context.getBuildFileURL();
} else {
...
contextFile = context.getBuildFile();
}
if (context.isIgnoringProjectTag() && !dupFile.equals(contextFile)) {
project.log("Duplicated project name in import. Project "
+ context.getCurrentProjectName() + " defined first in " + dup
+ " and again in " + contextFile, Project.MSG_WARN);
}
I think this bug has been fix and this issue would be closed.
Thanks to all.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
DO NOT REPLY [Bug 49162] incorrect duplicated project name warning
when imports from URL-providing resource
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49162
Sky Ao <ao...@gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEEDINFO |RESOLVED
Resolution| |FIXED
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
DO NOT REPLY [Bug 49162] incorrect duplicated project name warning
when imports from URL-providing resource
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49162
Stefan Bodewig <bo...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|REOPENED |NEEDINFO
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
DO NOT REPLY [Bug 49162] incorrect duplicated project name warning
when imports from URL-providing resource
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49162
Stefan Bodewig <bo...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
Resolution|FIXED |
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
DO NOT REPLY [Bug 49162] incorrect duplicated project name warning
when imports from URL-providing resource
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49162
Antoine Levy-Lambert <an...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Version|1.8.0 |1.8.1
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
DO NOT REPLY [Bug 49162] incorrect duplicated project name warning
when imports from URL-providing resource
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49162
Stefan Bodewig <bo...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |1.8.1
--- Comment #1 from Stefan Bodewig <bo...@apache.org> 2010-04-22 07:18:52 EDT ---
I think this is fixed now by svn revision 936784 but I'm having a hard time
creating a test case.
Could you try to build Ant from svn and see whether the problem is really
fixed?
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.