Intellij Plugin - can i read a maven pom file? - intellij-idea

With intellij plugins I have access to PsiFiles, which let me read the contents of a, say, java file. They provide, in effect, a tree-like structure for examining a file, which is great.
Is there some way to do the same - or similar - with a pom.xml file? If so, how would I do this?

Related

How to see dependency tree for JARS in IntelliJ using SBT

I am using intelliJ IDEA 2017.2.5 for spark-scala using SBT.
i have many dependencies jars but i wanted to know that which jar is getting downloaded or coming along BECOZ of which jar.
For example i have specified Jar_1 in my build.sbt file. Now when the project is built using SBT, along with Jar_1, multiple jars like jar_1.1, jar_1.2, jar_1.3 also gets downloaded. Now when i click on jar_1.3 or jar_1.2 i don't see the directory or any tree like structure which shows that its a child of Jar_1.
This feature is present in Eclipse. Attaching the image which shows this kind of Hierarchy.
As you can see the jars and also it shows that because of which jars it was downloaded. I need to know that whether such thing is available in IntelliJ if yes how to use it
It's not possible in IntelliJ IDEA for the SBT based projects at the moment, please vote for this feature request.

What is a working directory in Intellij IDEA

I created a Maven project and imported it in Intellij IDEA.
In a run configuration, there is a field "working directory", which points to the root of Maven project.
If I change this folder, it doesn't seem to affect anything. So what is it?
This is the directory that is set as the Java user.dir system property. If you have any code that creates relative files or directories, it will be relative to this directory. So for a well designed application (i.e. resolves resources from the classpath and is configurable for output directories) this will not be a factor. There is also some importance to this value in maven projects, especially multi-module maven projects. This directory specifies the directory IDEA will read the POM from.
If you are unflamilar with what the Java user.dir is, there is some discussion available here and in the class level Javadoc for the File class.
In addition to answer given by #Javaru if you want to update or view your working directory in IntelliJ IDEA go to:
Run | Edit Configurations | Configuration Tab | Working Directory
From the IntellJ help Run/Debug Configuration: Maven
Working directory Specify the path to the Maven project file pom.xml.

IntelliJ IDEA spring template project

In IntelliJ IDEA is there a way of creating a Spring Template Project as in Spring Source ToolSuite ? The intention over here is to get a POM file created automatically with the dependencies related to a Spring Project as in Spring Source ToolSuite. The existing way of IntelliJ IDEA is to create a Maven project and then to modify the POM file. Any information regarding this would be appreciated.
I don't know much about intelliJ, but all of the template projects are available on giyhub. There are URLs that aggregate the links to the template repositories. Take a look at these two files and the clone the project that you want to use as a template:
http://dist.springsource.com/release/STS/help/descriptors-3.0.xml
https://raw.github.com/SpringSource/spring-integration-templates/master/si-sts-templates/builds/descriptor.xml

Get full name of an artifact in Maven

I need to know the complete filename of a specific artifact in Maven. I looked at versions-maven-plugin but it seems to change the pom itself. Is there another way to reach my goal? I want to store the complete artifact name in a property so I can pick it up in Java code.
Normally you have your dependencies and let maven do all the work of retrieving the files from the repository for you.
But you want to use it in your Java code - what Java code?
Are you writing your own mojo that will be doing something during the install phase of your lifecycle?
Then you should be able to access the artifacts that are currently being processed, from there it's not a problem to get the filename.
But maybe you've got just the groupId, artifactId, version and type of an already existing artifact.
With these informations it should be no problem to navigate to your local maven repository, open the directory: groupId/artifactId/version and look what files you've got there. Usually there should be your .pom a .jar, maybe a md5-hashsum and some maven-metadata. If you're not sure which file's the interesting one: take that one with the biggest filesize.

pax-run using Maven Plugin in pom.xml

How can I execute Pax-Runner tasks using a Maven Plugin, which I can specify in the pom.xml file?
i.e. I can do the following in command line using Pax-Runner (to convert a war file into an OSGi bundle)
pax-run war:file:C:/somefile.war warref:C:/somefile.properties
What should I do to make it happen in a pom.xml file?
Thanks in advance!
There is a maven plugin for pax. I've not used it, but according to the documentation it does what you need. On the usage page there's a section titled Using the Pax Plugin inside a POM that describes how to set up your project.