|
I'd also suggest to change and write some tests. I didn't want to change too much, though. Which issue was this cloned from? Please create a link to it. The issue My patch is against r559855 of 2.2-SNAPSHOT (trunk). I tried the 2.2-SNAPSHOT and the same problem still exists if the master-pom is at the same level as the child-poms. C:\Foo\parent\pom.xml C:\Foo\child\pom.xml In cases like that, i.e. if the path of the submodule must contain ".." the behavior is still like in the original bug-report. That's why I cloned it instead of creating a new one which was probably wrong on my side. I thought this would be wise since the previous fix only fixed a special-case of the problem. To clarify my point a little more: calling toRelative("C:\Foo\bar1", "C:\Foo\bar2") must return "../bar2" but currently returns "C:/Foo/bar2". It appears that the bug only occurs in maven 2.0.7.. When I run the goal in maven 2.0.6 it works fine. I'm experiencing the same. It works with 2.0.6, not with 2.0.7. It does works in os x though (with 2.0.7), but not in Windows (cmd and cygwin). same here: win xp + idea 6 + maven 2.0.7 + maven-idea-plugin 2.1 (and 2.0 too I believe) = wrong iml paths in the ipr of a multimodule project. Confirming it doesn't work for idea 2.0 or 2.1. It's maven 2.0.7 and win xp combination that is breaking. Workaround Make sure you still have maven 2.0.6 still installed. export M2_HOME=/cygdrive/c/develop/build/maven-2.0.6 or if you're using cmd: Afterwards throw away that shell instance, as it won't be using maven 2.0.7. Hello! class AbstractIdeaMojo: protected String toRelative( File basedir, String absolutePath ) String fileSeparator = System.getProperty("file.separator"); relative = StringUtils.replace( relative, " if ( getLog().isDebugEnabled() ) { getLog().debug( "toRelative(" + basedir + ", " + absolutePath + ") => " + relative ); } return relative; Hi there I just tested it with the 2.2-SNAPSHOT and got a wrong result! My project structure is: ch.ki.ras/ where the first directory contains the master POM. What I get in the project file ch.ki.ras/ch.ki.ras.ipr is <module filepath="$PROJECT_DIR$/ch.ki.ras.iml"/> So not only the path is not relative to the main POM, but also the path information is trucated. Instead it should be <module filepath="$PROJECT_DIR$/../ch.ki.ras/ch.ki.ras.iml"/> Would be wunderful to get a new SNAPSHOT soon! Thanks I am running XP, Maven 2.0.8, Maven IDEA plugin 2.1 and Cygwin. When I issue 'mvn idea:idea' on the XP command line my IDEA project file is fine. When I issue the same command in Cygwin, the paths are incorrect. Using the 2.2-SNAPSHOT it works fine, except for the above noted conditions where the parent and module dirs are at the same level. This is a different bug. This issue is working on over 8 months without a release, yet there is a fix for one of the show stopping bugs which prevents you from using the plugin. 2.2 should be released as is now and a new fresh jira issue should be created to address the bug about the paths being incorrect for when the parents and modules are at the same level. This plugin is broken without releasing 2.2. Actually, I just tested Roman's code above - adding it to the latest 2.2-SNAPSHOT and the paths are correct for an idea project with the parent and modules at the same level. The modules paths are correctly relative using "../". Someone should throw that code in there, close this out and release 2.2. WFM.
I couldn't agree more I would add it - but I'm new to this project so I don't know how to get permissions to check in code and what the official release process is. How do you become a committer? Also, someone should check out the ClassWorlds dependency for the tests. The tests fail because they are missing the ClassWorlds dependency. <dependency> Thanks for trying the patch. As I don't have a cygwin environment I have not been able to verify the patch. I'll have a look at the patch. ... just click through 'next' on everything and get the basic install. quick easy setup... beats the windows prompt for those on the corporate XP system! I have committed the patch, with modifications. I also added a small test case. A new SNAPSHOT has been deployed, please verify that it solves this issue. I had to build using mvn clean install -Dmaven.test.skip=true because otherwise the build would fail with the following messages: Running org.apache.maven.plugin.idea.IdeaModuleTest org.apache.maven.plugin.test:plugin-test-1919 Caused by: required artifacts missing: for the artifact: from the specified remote repositories: [WARNING] An error occurred during dependency resolution of the following artifact: org.apache.maven.plugin.test:plugin-test-2222 Caused by: required artifacts missing: for the artifact: from the specified remote repositories: [WARNING] Unable to get resource from repository test-repo (file://P:\misc\maven-idea-plugin\src\test\remote-repo Results : Failed tests: Tests run: 37, Failures: 1, Errors: 0, Skipped: 0 But beside that, the current version works as expected for me. Just tested it with maven-idea-plugin-2.2-20080308.204124-6. For me, this issue (http://jira.codehaus.org/browse/MIDEA-102#action_122161 Daniel, please open another issue for that. It is a different issue than this one. Also attach a small test project that can be used to reproduce the issue. Dennis, the patch you applied is highly unnecessarily complex. Take a look at the patch that Roman lists above. This is the one that should be applied. Its 3 times smaller and easy to follow. If Roman's patch does not work, please explain why your patch works better. However, Daniel, I have tested both Roman's patch and Dennis' patch, and they both work. I did not pull the snapshot though, I complied the patches myself. You may want to delete the .m2\repository\org\apache\maven\plugins\maven-idea-plugin directory to ensure you are in fact using the 2.2-SNAPSHOT. If it still does not work, please elaborate using the test pom's below. Example: <module filepath="$PROJECT_DIR$/parent.iml"/> Is the result of running mvn idea:idea on: c:\foo\parent\pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" </project> c:\foo\child\pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" </project> So, again, lets throw Roman's patch in 2.2 and release this puppy. Nothing else is open for 2.2. Thanks. gotama, There is no patch from Roman - it's just a piece of code embedded in a comment. That won't show up on my radar when I'm looking for patches to apply. Contributors should alway supply a patch-file and attach it to the issue. The patch I applied wasn't mine , but came from Joern who was the person who filed this issue. That being said, I'll probably throw the whole toRelative() method out and use a method from doxia tools instead. That code includes lots unit tests and has been extracted from already tried and tested components. We still need to get a release of it out the door. In the meantime I'll push out another SNAPSHOT using that code. Stay tuned. What is the status of this issue? I'm willing to forgo the whole implementation style argument for simply getting "A" fixed version of 2.2 out the door. The current SNAPSHOT works, so I vote for releasing it, then later on revisiting the 3 different ways the paths can be corrected. The important thing is that it is fixed. In the mean time, there are people out there trying to use Maven for the first time, and they will not be impressed when 'mvn idea:idea' does not work. This is one of the cool selling points of Maven to a team of developers and its been busted for a year. Release 2.2... Thanks. The tests currently fail in Linux/Unix environments. I need to try and fix that before I can make the release. Dennis, Have you made any headway on this? I'm sure a lot of people would appreciate this fix and a working 2.2 IDEA Maven2 plugin. How can we help? When you say the tests fail, are those checked in 2.2 junit tests? We should be able to do something like create a test project and a junit test, check them in, and then test it in all environments (XP/Cygwin, XP, Linux, OSX) until it passes. Is this already checked in? If it is, then contributors could try to fix it and we'd all agree on exactly what has to pass. Can we try to outline this? Thanks, For me this issue is open for the described file structure (see comments above). However, a slightly altered patch works fine. Please find it attached. I've managed to make the test pass on both Windows and Ubuntu now. It would be great if people could test the new maven-idea-plugin 2.2-20080719.165010-7 SNAPSHOT that I have deployed. Also I would appreciate if someone with Cygwin installed could run 'mvn test' on the SVN trunk, to make sure the tests pass there as well. OK, I'm closing this as fixed now. I got one response in private that it works. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
the problem still exists if the master-module is at the same level as the child module, e.g. C:\foo\master and C:\foo\child.
The attached patch fixes this problem.