IntelliJ not reading pom.yml in maven polyglot project

已回答

Hi,

a colleague and I are both using 2019.1

We have a maven java project in git which is using the polyglot plugin / extension.xml to read a pom.yml file as YAML instead of XML.

For me this works fine. I did the XML -> YAML conversion.

However my colleague has imported the project from git and IntelliJ is struggling to load it properly. It claims to read the pom.yml and then it starts loading the dependencies, but for reasons unknown, it stops, leaving the project unbuildable.

The only clue I have is that the Maven Tool window has underlined the project name (which it can't read, hence 'Unknown') and shows this error:

 

This tells me that something in IntelliJ still thinks that the pom should be XML.

Yet the .mvn/extensions.xml file is correct and maven on the CLI can read it happily. What has my colleague not done that I managed to do? We have compared all settings we can think of (settings.xml, Maven settings dialog etc)

Thanks.

0

Do you use same OS? Can you build from command line? Could be caused by illegal character in file.

Please try File | New | project from Existing Sources action and point to pom.yml file to import it as a Maven project. Does it help?

If issue remains can you please provide a sample project to check?

0

We're both using Windows 10, and we can both build with mvn on the CLI. There's nothing illegal in the file as far as my installation goes - my colleague just pulled it from git and without changing any files, gets this issue.

I'll ask him to try your suggestion.

0

Hi,

I tried your suggestion (Adam sat here now) and I get the same behaviour.

I have uploaded the test mvn project to https://uploads.services.jetbrains.com/

 

Uploading...
File uploaded: polyglot.zip
Upload complete!

Thanks

Antony

 

0

You miss .mvn directory in project with yml maven extension configured. See 2. Maven Core Extension Loading Mechanism in Maven Polyglot tutorial for an example how to configure it.

0

Sorry, that's obviously the default windows zip mechanism ignoring . prefixed dirs. I just uploaded the corrected zip, using the same name. 

0

Works just fine for me.

But I did have the mentioned problem without .mvn directory. Do you get issue with any similar project?

Attach IDE log folder zipped to check.

0

Hi,

 

Im getting this in the logs:

 

2019-04-25 16:08:36,791 [ 344415] WARN - #org.jetbrains.idea.maven - org.apache.maven.model.io.ModelParseException: only whitespace content allowed before start tag and not m (position: START_DOCUMENT seen m... @1:1)
java.lang.RuntimeException: org.apache.maven.model.io.ModelParseException: only whitespace content allowed before start tag and not m (position: START_DOCUMENT seen m... @1:1)
at org.apache.maven.model.io.DefaultModelReader.read(DefaultModelReader.java:122)
at org.apache.maven.model.io.DefaultModelReader.read(DefaultModelReader.java:86)
at org.apache.maven.model.io.DefaultModelReader.read(DefaultModelReader.java:55)
at org.jetbrains.idea.maven.server.Maven3ServerEmbedderImpl.readModel(Maven3ServerEmbedderImpl.java:1176)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:357)
at sun.rmi.transport.Transport$1.run(Transport.java:200)
at sun.rmi.transport.Transport$1.run(Transport.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:573)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:834)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:688)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:687)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.RuntimeException: org.codehaus.plexus.util.xml.pull.XmlPullParserException: only whitespace content allowed before start tag and not m (position: START_DOCUMENT seen m... @1:1)
at org.codehaus.plexus.util.xml.pull.MXParser.parseProlog(MXParser.java:1557)
at org.codehaus.plexus.util.xml.pull.MXParser.nextImpl(MXParser.java:1436)
at org.codehaus.plexus.util.xml.pull.MXParser.next(MXParser.java:1131)
at org.apache.maven.model.io.xpp3.MavenXpp3Reader.read(MavenXpp3Reader.java:3849)
at org.apache.maven.model.io.xpp3.MavenXpp3Reader.read(MavenXpp3Reader.java:595)
at org.apache.maven.model.io.DefaultModelReader.read(DefaultModelReader.java:117)

 

Thanks

Antony

 

0

Looks like this exception and the error is shown when IDE is trying to read pom file as an xml file when in fact it has another format. But I can only reproduce this when there is no .mvn directory in the same directory when the pom.yml file is located.

Do you get issue with any similar projects? What Maven version do you use? It could also be that the Maven configured in IDE cannot find the

polyglot-yaml

library in it's local repository. Make sure you use same Maven in IDE and in command line.

Try also using different Maven in Settings (Preferences on macOS) | Build, Execution, Deployment | Build Tools | Maven | Maven home directory.

Please provide IDE log folder zipped if problem remains.

0

请先登录再写评论。