Questions tagged [pom.xml]
A Project Object Model or POM is the fundamental unit of work in Maven.
pom.xml
5,313
questions
1078
votes
15
answers
446k
views
Differences between dependencyManagement and dependencies in Maven
What is the difference between dependencyManagement and dependencies?
I have seen the docs at Apache Maven web site.
It seems that a dependency defined under the dependencyManagement can be used in ...
452
votes
14
answers
272k
views
IntelliJ - Convert a Java project/module into a Maven project/module
I have a project on Bitbucket. Only the sources are committed. To retrieve the project onto a new machine, I used Version Control > Checkout from Version Control from within IntelliJ.
It then asks ...
328
votes
5
answers
220k
views
What is pluginManagement in Maven's pom.xml?
This is a snippet of my pom file.
...
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-...
263
votes
5
answers
339k
views
How do you specify the Java compiler version in a pom.xml file?
I wrote some Maven code in Netbeans that has approximately more than 2000 lines. When I compile it on Netbeans, everything is fine, but if I want to run it on command line, I will get these errors:
...
247
votes
4
answers
259k
views
What is <scope> under <dependency> in pom.xml for?
Looking at documentation http://maven.apache.org/surefire/maven-surefire-plugin/examples/testng.html, we can see <scope> tag under <dependency>
What is that and how can we use it for ...
222
votes
11
answers
238k
views
What does mvn install in maven exactly do
I just started using Maven and I was told to do mvn install in a specific directory.
What does mvn install do, exactly?
I think it looks for pom.xml in the current folder and starts following the ...
220
votes
6
answers
248k
views
How to refer environment variable in POM.xml?
I am using maven as build tool. I have set an environment variable called env. How can I get access to this environment variable's value in the pom.xml file?
195
votes
12
answers
120k
views
stop IntelliJ IDEA to switch java language level every time the pom is reloaded (or change the default project language level)
Using IntelliJ 12, I have a java project and I use maven with a pom.xml.
My project is using java8, but it seems the default project language level has been set to 6 while importing the project.
I ...
192
votes
15
answers
434k
views
Specify JDK for Maven to use
I am trying to build a Hudson plugin I've modified and it requires jdk1.6. This is fine, but I don't see how I can tell maven where the different jdk is. I've found few mentions on the internet but ...
178
votes
10
answers
108k
views
What is the difference in Maven between dependency and plugin tags in pom.xml?
Created project with Spring, Hibernate & Maven. My question is what is the logic behind plugin versus dependency ?
170
votes
12
answers
247k
views
Is there anyway to exclude artifacts inherited from a parent POM?
Artifacts from dependencies can be excluded by declaring an <exclusions> element inside a <dependency> But in this case it's needed to exclude an artifact inherited from a parent project. ...
163
votes
17
answers
241k
views
Maven: The packaging for this project did not assign a file to the build artifact
I'm using Maven 3.0.3 on Mac 10.6.6. I have a JAR project and when I run the command "mvn clean install:install", I'm getting the error,
[ERROR] Failed to execute goal org.apache.maven....
163
votes
3
answers
136k
views
What is the difference between "pom" type dependency with scope "import" and without "import"?
Starting from Maven 2.0.9 there is possibility to include
<type>pom</type>
<scope>import</scope>
in the <dependencyManagement> section.
As I understand it, it will be ...
146
votes
21
answers
194k
views
Why am I getting Unknown error in line 1 of pom.xml?
Getting unknown error at Line 1 in pom.xml in Eclipse IDE.
It was working fine till yesterday, but all of a sudden after updating my project from master and after fixing merge conflicts getting "...
138
votes
2
answers
61k
views
Install parent POM without building Child modules
I have a parent POM in a Maven project, with this structure:
parent
|
---------------
| |
child1 child2
I want to install the POM ...
134
votes
16
answers
254k
views
Error when deploying an artifact in Nexus
Im' getting an error when deploying an artifact in my own repository in a Nexus server: "Failed to deploy artifacts: Could not transfer artifact" "Failed to transfer file http:///my_artifact. Return ...
130
votes
7
answers
60k
views
Maven: Lifecycle vs. Phase vs. Plugin vs. Goal [closed]
Relatively new developer here, even though I've been using it for a little while, I'm hoping to solidify my Maven fundamentals. Part of my problem is that I have no experience with Ant, which seems to ...
129
votes
4
answers
281k
views
Maven: How do I activate a profile from command line?
This is a snippet from my pom.xml.
I tried the following, but the profile was not activated.
mvn clean install -Pdev1
mvn clean install -P dev1
When I tried mvn help:active-profiles no profiles were ...
127
votes
4
answers
89k
views
Is there a way to exclude a Maven dependency globally?
I’m trying to find a “generic” way of excluding a transitive dependency from being included without having to exclude it from all the dependencies that depend on it. For example, if I want to exclude ...
116
votes
4
answers
108k
views
What does the parent tag in Maven pom represent?
E.g.:
<parent>
<groupId>mycompany.trade.com</groupId>
<artifactId>mycompany.trade.</artifactId>
<version>1.1.1.0-SNAPSHOT</version>
</parent&...
115
votes
12
answers
214k
views
Missing artifact com.microsoft.sqlserver:sqljdbc4:jar:4.0
I am trying to add MS SQL driver dependency in my POM.xml file and the following is the dependency.
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>...
108
votes
13
answers
134k
views
Maven Build Failure -- DependencyResolutionException
I'm installing a package that has Maven dependency and get a DependencyResolutionException when I try to clean it.
After cloning it, I navigate to the directory and run the following to install it ...
103
votes
17
answers
291k
views
Maven Out of Memory Build Failure
As of today, my maven compile fails.
[INFO] [ERROR] Unexpected
[INFO] java.lang.OutOfMemoryError: Java heap space
[INFO] at java.util.Arrays.copyOfRange(Arrays.java:2694)
[INFO] at java.lang.String....
101
votes
1
answer
61k
views
Difference between <plugins> and <pluginManagement> tag in Maven `pom.xml` [duplicate]
While configuring my pom.xml, I had to configure a plugin. What I found out is that the <plugin> tag may be inserted inside either <plugins> or <pluginManagement> elements. I am ...
94
votes
3
answers
109k
views
How to include a config file in the "META-INF/services" folder of a JAR using Maven
I'm working on a Java project in Eclipse, which is built using Maven. I'm using some recycled code from an older project, and one of these classes looks for a file in the META-INF/services folder of ...
94
votes
4
answers
138k
views
Maven cannot resolve dependency for module in same multi-module project
When running commands such as
mvn dependency:build-classpath
or
mvn exec:java
Maven is unable to resolve a dependency of one of my modules on another.
[ERROR] Failed to execute goal on ...
92
votes
3
answers
168k
views
repository element was not specified in the POM inside distributionManagement element or in -DaltDep loymentRepository=id::layout::url parameter
I'm having a problem while deploying and here is the error message I get:
[INFO]
[INFO] --- maven-deploy-plugin:2.7:deploy (default-deploy) @ core ---
[INFO] -------------------------------------------...
90
votes
2
answers
207k
views
Meaning of ${project.basedir} in pom.xml
What is the meaning of
<directory>${project.basedir}</directory>
and
${project.build.directory}
in pom.xml
80
votes
5
answers
137k
views
Gradle build.gradle to Maven pom.xml
I have a Gradle project and I need all its dependencies to be transferred and used with another Maven project. In other words how can I generate (or can I generate) the pom.xml from the build.gradle?
79
votes
12
answers
160k
views
Maven: Invalid target release: 10
I'm trying to compile my maven project using Java 10 but I'm having trouble. In my IDE (IntelliJ IDEA) everything compiles and runs just fine under Java 10. I installed the latest maven version 3.5.4 ...
78
votes
7
answers
216k
views
Maven adding mainClass in pom.xml with the right folder path
I want to get a working jar file with my maven project.
The build part is:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
...
74
votes
5
answers
162k
views
How to specify Java version in Spring/Spring Boot pom.xml?
What is the correct way of specifying Java 11 as the version to be used in Spring (or Spring Boot) pom.xml file?
I.e., what value do I need to put in the java.version property of the pom?
For Java 8 ...
73
votes
1
answer
88k
views
How can I view transitive dependencies of a Maven pom.xml file?
Is there a CLI tool I can use to quickly view the transitive dependencies of a Maven pom.xml file?
68
votes
7
answers
128k
views
Plugins in Maven and POM.xml
I just started using Maven and I read that plugins are additional components that can be used.
A typical structure of pom.xml file is
<project>
<groupId>org.koshik.javabrains</...
67
votes
13
answers
132k
views
An internal error occurred during: "Updating Maven Project". Unsupported IClasspathEntry kind=4
As the title mentioned I have the following problem: I use Eclipse with Maven Nature and when I update my Maven Project, I get this error:
An internal error occurred during: "Updating Maven Project"...
66
votes
6
answers
50k
views
Maven: Including jar not found in public repository
If I was to use a 3rd party library that was not in the maven public repository, what is the best way to include it as dependency for my project so that when someone else checks out my code it will ...
64
votes
4
answers
209k
views
.m2 , settings.xml in Ubuntu [duplicate]
In the windows environment you will have .m2 folder in C:\Users\user_name location and you will copy your settings.xml file to it in order to setup your proxy settings and nexus repository locations ...
62
votes
20
answers
83k
views
Maven Error : Maven Project Configuration for Module isn't available
I keep getting this error when I try to compile my code. I have the pom.xml file in my directories but I am not sure if there is something wrong in there. I found only one link on the internet ...
59
votes
4
answers
99k
views
Is it possible to pass a password in Maven Deploy in the command line?
This is the way it currently works, and it's the Maven Deploy Plugin Usage
pom.xml
[...]
<distributionManagement>
<repository>
<id>internal.repo</id>
<...
59
votes
9
answers
282k
views
Maven:Non-resolvable parent POM and 'parent.relativePath' points at wrong local POM
I am using maven 3 to run the application but I am getting the following error:
[ERROR] The build could not read 1 project -> [Help 1]
org.apache.maven.project.ProjectBuildingException: Some ...
57
votes
7
answers
20k
views
Gradle not including dependencies in published pom.xml
I have a Gradle project I'm using the maven-publisher plugin to install my android library to maven local and a maven repo.
That works, but the generated pom.xml does not include any dependency ...
57
votes
3
answers
45k
views
Maven alternate pom
Is there an argument when calling a maven build to specify an alternate file in place of the standard pom.xml file name?
Basically, I have a need to run the test goal of my maven build with a variety ...
55
votes
4
answers
63k
views
Missing artifact com.sun.jdmk:jmxtools:jar:1.2.1
I have created simple project from maven-achetype-quickstart under Eclipse Indigo, then I went to pom.xml gui editor and in dependencies tab added dependency log4j by search in appropriate dialog. Now ...
52
votes
4
answers
106k
views
How do I run a specific goal with a particular configuration in a Maven plugin when I have several configurations for that goal
See plugin config from pom.xml below.
I can do:
mvn myplugin:myGoal
Which runs myGoal (both executions I suppose) but I want to be able to choose either the first or the second executions ...
52
votes
5
answers
93k
views
What is the difference between artifactId and groupId in pom.xml?
How would you explain it to a newbie web developer or programmer with some real world organization example (like say facebook company or Google company)?
52
votes
3
answers
50k
views
Maven - Depend on assembled zip
I'm trying to have a Project B pull down (and unpack) a ZIP built by Project A and deployed to a remote repository.
The ZIP is created and attached using the maven-assembly-plugin, with packaging ...
51
votes
5
answers
98k
views
Where do CSS and JavaScript files go in a Maven web app project?
I am switching to use Maven for my Spring web app projects and I am running into a simple issue. I am not sure where to put the CSS and JS files in the new project structure.
Traditional Web App ...
51
votes
1
answer
27k
views
maven dependency tree - version managed
In my project I see the following when issuing mvn dependency:tree -Dverbose:
[INFO] | | \- xalan:xalan:jar:2.7.2:compile (version managed from 2.7.0)
[INFO] | | \- xalan:serializer:jar:2.7.2:...
51
votes
2
answers
160k
views
The POM for project is missing, no dependency information available
Background
Trying to add a Java library to the local Maven repository using a clean install of Apache Maven 3.1.0, with Java 1.7. Here is how the Java archive file was added:
mvn install:install-...
50
votes
6
answers
120k
views
Remove or delete resource files from target directory using pom file
I have two profiles in pom.xml, and I have some resource files which I have added into target resource directory: ${project.build.outputDirectory}/resources during execution of the first profile. What ...