History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: IDEADEV-22126
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Critical Critical
Assignee: Anton Makeev
Reporter: Nasokin Arseny
Votes: 1
Watchers: 3
Operations

If you were logged in you would be able to see more operations.
IDEA: Development

Import from maven don't work.

Created: 20 Sep 07 11:59   Updated: 06 Dec 07 18:52
Component/s: Maven Integration
Fix Version/s: Selena 7.0.2

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown

Build: 7,291
Fixed in build: 7,556
Severity: Extreme


 Description  « Hide
7274 has no this bug

I have big project (here is structure only):

<root POM>
module1/<pom>
module2/<pom>
..
module5/<pom>
group/<pom>
group/gr-module1/<pom>
group/gr-module2/<pom>

specialGroup/<pom>
specialGroup/sg-module1/<pom>
specialGroup/sg-module2/<pom>

where specialGroup is group when specialGroupProfile is enabled.

Inital import from maven is good (without modules from the specialGroup)

But when I enable profile for specialGroup, restart IntelliJ Idea, all modules (except root module) are disappeared.



 All   Comments   Work Log   Change History      Sort Order:
Nasokin Arseny - 20 Sep 07 13:29 - edited
if it'll help. I can send pom structure with scripts for workaround maven-embedded bugs.

Vladislav Kaznacheev - 21 Sep 07 00:01
please do send pom structure

Alejandro Scandroli - 01 Oct 07 15:40
I'm having this same problem. I've upgraded from 7274 to 7312 (on ubuntu) and I lost the ability to import maven projects with multiple modules.
Here is my parent pom.xml: http://svn.codehaus.org/trails/trunk/trails/pom.xml
You can download the whole project from there.

Vladislav Kaznacheev - 05 Oct 07 19:12
Anton, I am going to look into this on the weekend.

Vladislav Kaznacheev - 06 Oct 07 20:22
Alejandro,

The reason is that this project does not validate with the latest versions of Maven (try running validate goal).

If your replace references to ${hsqldb.version} with actual version number, I will import OK


Alejandro Scandroli - 09 Oct 07 14:46
It does actually validate using maven 2.0.7. Are you using a newer version?
I will try replacing the references to ${hsqldb.version} and I will get back to you.
BTW, It's working fine on 7274.

Nasokin Arseny - 10 Oct 07 20:30
heh))

I use same version names, but do following to `resolve' them (works fine with eclipse, EAP 7274)

1. mvn install -D... (enable all profiles to install all modules)
2. make links in local maven repository (just copy) from <real version> to the '${version.name}' (dirs & jar/pom/sha) to get correct resolving 'group:artifact:${version}' (without resoulution of variable)
3. import project in Idea.

Scripts for 'patching' maven repository:
(this scripts can be run under the bash or BSD sh, small patching may be needed, under windows I use MinGW)

patchdir
#!/bin/zsh
rootdir=$1
fromexpr=$2
toexpr=$3
cmd=$(echo "s/${fromexpr}/${toexpr}/g")
find ${rootdir} -type f | while read infile; do
    outfile=$(echo "$infile"|sed -e "${cmd}")
    [[ "$infile" == "$outfile" ]] && continue ;
    outdir=$(dirname $outfile)
    [[ -d "${outdir}" ]] || { rm -rf ${outdir}; mkdir -p "${outdir}"} ;
    rm -f "${outfile}"
    cp -v "${infile}" "${outfile}"
done
projectfix
#!/bin/zsh
PROJECT=~/projects/MyProject
cat ${PROJECT}/project-fix | while read line;do dir=${MVN_REPOSITORY}/`echo $line|awk -F: '{print $1}'`; ver=`echo $line|awk -F: '\{print $2}'`;
realver=`grep -h "<${ver}>" ${PROJECT}/pom.xml | sed -e 's/^.*>\([^<]*\)<.*$/\1/'`;
patchdir "$dir" "$realver" "\${$ver}"
done
part of project-fix data file
commons-lang/commons-lang:commons.lang.version
commons-beanutils/commons-beanutils:commons.beanutils.version
commons-dbcp/commons-dbcp:commons.dbcp.version
commons-collections/commons-collections:commons.collections.version
commons-pool/commons-pool:commons.pool.version
commons-logging/commons-logging:commons.logging.version
dbunit/dbunit:dbunit.version
groovy/groovy-all:groovy.version
jdom/jdom:jdom.version
junit/junit:junit.version

Nasokin Arseny - 15 Oct 07 11:34
in 7346 build:
While importing from maven, modules are added to the maven structure correctly. but there're no modules in project structure.

Nasokin Arseny - 15 Oct 07 11:53
I got same exceptions;

local maven is 2.0.7

2007-10-15 11:45:39,336 [ 38933] INFO - aven.project.MavenProjectModel -
java.lang.ClassCastException: org.apache.maven.artifact.repository.DefaultArtifactRepository cannot be cast to org.apache.maven.model.Repository
at org.apache.maven.DefaultMavenTools.buildArtifactRepositories(DefaultMavenTools.java:64)
at org.apache.maven.project.build.model.DefaultModelLineageBuilder.updateRepositorySet(DefaultModelLineageBuilder.java:243)
at org.apache.maven.project.build.model.DefaultModelLineageBuilder.resumeBuildingModelLineage(DefaultModelLineageBuilder.java:149)
at org.apache.maven.project.DefaultMavenProjectBuilder.assembleLineage(DefaultMavenProjectBuilder.java:1044)
at org.apache.maven.project.DefaultMavenProjectBuilder.buildInternal(DefaultMavenProjectBuilder.java:701)
at org.apache.maven.project.DefaultMavenProjectBuilder.buildFromSourceFileInternal(DefaultMavenProjectBuilder.java:459)
at org.apache.maven.project.DefaultMavenProjectBuilder.build(DefaultMavenProjectBuilder.java:213)
at org.apache.maven.embedder.MavenEmbedder.readProject(MavenEmbedder.java:413)
at org.jetbrains.idea.maven.project.MavenProjectReader.readBare(MavenProjectReader.java:33)
at org.jetbrains.idea.maven.project.MavenProjectModel.createMavenTree(MavenProjectModel.java:77)
at org.jetbrains.idea.maven.project.MavenProjectModel.createMavenTree(MavenProjectModel.java:105)
at org.jetbrains.idea.maven.project.MavenProjectModel.createMavenTree(MavenProjectModel.java:105)
at org.jetbrains.idea.maven.project.MavenProjectModel.<init>(MavenProjectModel.java:46)
at org.jetbrains.idea.maven.project.MavenImportProcessor.createMavenProjectModel(MavenImportProcessor.java:181)
at org.jetbrains.idea.maven.project.MavenImportProcessor$1.run(MavenImportProcessor.java:141)
at com.intellij.openapi.progress.impl.ProgressManagerImpl$3.run(ProgressManagerImpl.java:2)
at com.intellij.openapi.progress.impl.ProgressManagerImpl$2.run(ProgressManagerImpl.java:11)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:50)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcess(ProgressManagerImpl.java:11)
at com.intellij.openapi.application.impl.ApplicationImpl$7$1.run(ApplicationImpl.java:14)
at com.intellij.openapi.application.impl.ApplicationImpl$5.run(ApplicationImpl.java:3)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
at java.lang.Thread.run(Thread.java:619)
at com.intellij.openapi.application.impl.ApplicationImpl$1$1.run(ApplicationImpl.java:11)


Nasokin Arseny - 15 Oct 07 12:32
As workaround, you can work with new idea with old maven plugin.

Anton Makeev - 17 Oct 07 13:43
Could you please attach simple pom project structure so that I could reproduce this problem?

Anton Makeev - 25 Oct 07 18:58
Arseny, do you still have the problem?
If you do it would be great if you attach pom files so i could reproduce problem.

Alejandro Scandroli - 26 Oct 07 17:35
status update:
I'm using release 7.0.1 (build 7634).
If I replace references to ${*.version} with version numbers, I does import OK
The "soft links" workaround also works, but then I have to create files like:
~/.m2/repository/hsqldb/hsqldb/${hsqldb.version}/hsqldb-${hsqldb.version}.pom
~/.m2/repository/hsqldb/hsqldb/${hsqldb.version}/hsqldb-${hsqldb.version}.jar
Which is not only painful to do, it also doesn't let me use more than 1 different version for the same library.

I still think that Idea should be able to import projects that are using "<properties>" to define libraries version numbers.
Maven 2.0.7 does validate the project.


Anton Makeev - 26 Oct 07 17:47
Alejandro,
As i understand it correctly this issue was originally created by Nasokin Arseny having problems with multi-module project and profiles.

For you problem i've created separate issue IDEADEV-22863.


Alejandro Scandroli - 26 Oct 07 17:56
Ahh, ok. I'm sorry.
Thanks.

Anton Makeev - 26 Oct 07 17:58
No worries 8)

Nasokin Arseny - 30 Oct 07 10:35
7364 build tested: there're no exceptions, but log messages with all modules.

INFO - n.project.MavenToIdeaConverter - Cannot find module <module name>


Nasokin Arseny - 30 Oct 07 20:07
build 7523:

WARN - org.jetbrains.idea.maven.project.MavenProjectReader - org.apache.maven.artifact.repository.DefaultArtifactRepository cannot be cast to org.apache.maven.model.Repository


Nasokin Arseny - 13 Nov 07 10:50
Hey! it's seems work fine with 7549! good work!

Anton Makeev - 15 Nov 07 15:51
Thanks 8) We try to do utmost to make maven integration work well 8)
Thanks for you feedback anyway! 8)