maven error using intellij is referencing itself - java

I have this 2 simple pom.xml
main parent project and module which the project is using
main project pom.xml :
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.clouddispatcher</groupId>
<artifactId>clouddispatcher</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<modules>
<module>aws-manager</module>
</modules>
<dependencies>
<dependency>
<groupId>com.clouddispatcher</groupId>
<artifactId>aws-manager</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
</dependencies>
<properties>
<aws.java.sdk.version>1.11.875</aws.java.sdk.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk</artifactId>
<version>${aws.java.sdk.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
</project>
and the module pom.xml :
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>clouddispatcher</artifactId>
<groupId>com.clouddispatcher</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>aws-manager</artifactId>
<dependencies>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk</artifactId>
</dependency>
</dependencies>
</project>
now when I run :
mvn clean install
I keep getting this error :
The build could not read 1 project -> [Help 1]
The project com.clouddispatcher:aws-manager:1.0-SNAPSHOT (C:\Dev\my\java\clouddispatcher\aws-manager\pom.xml) has 1 error
'dependencies.dependency. com.clouddispatcher:aws-manager:1.0-SNAPSHOT' for com.clouddispatcher:aws-manager:1.0-SNAPSHOT is referencing itself. # com.clouddispatcher:clouddispatcher:1.0-SNAPSHOT, C:\Dev\my\java\clouddispatcher\pom.xml, line 23, column 21
To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.
For more information about the errors and possible solutions, please read the following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException

Let me explain the points of khmarbaise in more detail:
Parents cannot have Java classes. You need to remove the classes from the parent.
You cannot define circular dependencies, i.e. if A is a parent of B, it cannot have B as dependency.
You need to refactor your project to meet these criteria, e.g. by moving the classes from the parent to a second module.

Related

NoClassDefFoundError: javax/json/bind/JsonbBuilder even after adding javaee-api to dependencies

I am using maven with netbeans. Whenever I run the program it gives me java.lang.NoClassDefFoundError exception even after adding javaee-api 8.0 to dependencies.
Here is my pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>example</groupId>
<artifactId>JavaApp</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<debug>false</debug>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>12</maven.compiler.source>
<maven.compiler.target>12</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>8.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
I can see the javax.json.bind.* in Dependencies. I don't get why am I not able to run the program. Any pointers?
The problem you face is that you need to add libraries which you use in your project manually. As you said javaee-api has dependency to javax.json.bind.* but the scope of that is provided which means that it will provide by your jdk or a container (application server for example) in the runtime( for more information about scopes check this). So you need to add libraries you need as compile scope(the default scope) which you need them in runtime.

Invalid packaging for parent POM must be "pom" but is "war"

Could anybody suggest me an solution with the following exception. I am going to create a multi-module project. (War, Ear)
pom.xml (war)
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>lu.pgd</groupId>
<artifactId>WebBusiness</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>WebBusiness-war</artifactId>
<packaging>war</packaging>
<name>Web Business</name>
<properties>
<failOnMissingWebXml>false</failOnMissingWebXml>
<slf4j.version>1.7.5</slf4j.version>
</properties>
<build>
<finalName>webBusiness</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.3</version>
<configuration>
</configuration>
</plugin>
</plugins>
</build>
</project>
pom.xml (ear)
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>lu.pgd</groupId>
<artifactId>WebBusiness</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>spdv-ear</artifactId>
<packaging>ear</packaging>
<name>Project EAR</name>
<dependencies>
<dependency>
<groupId>lu.pgd</groupId>
<artifactId>WebBusiness-war</artifactId>
<version>${project.version}</version>
<type>war</type>
</dependency>
</dependencies>
<build>
<finalName>WebBusiness</finalName>
<plugins>
<plugin>
<artifactId>maven-ear-plugin</artifactId>
<version>2.10</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
</manifest>
</archive>
<applicationId>WebBusiness</applicationId>
<displayName>SPDV (${project.version})</displayName>
<modules>
<webModule>
<groupId>lu.pgd</groupId>
<artifactId>WebBusiness-war</artifactId>
<contextRoot>/WebBusiness</contextRoot>
<moduleId>war</moduleId>
</webModule>
</modules>
<defaultLibBundleDir>lib</defaultLibBundleDir>
</configuration>
</plugin>
</plugins>
</build>
</project>
pom.xml (parent)
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>lu.pgd</groupId>
<artifactId>WebBusiness</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Parent Project</name>
<modules>
<module>../SPDV_EAR</module>
<module>../WebBusiness</module>
</modules>
<packaging>pom</packaging>
</project>
When I tried to Run Maven Project Parent (Clean+Install) I got error like :
[INFO] Scanning for projects...
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[ERROR] Invalid packaging for parent POM lu.pgd:WebBusiness:0.0.1-SNAPSHOT, must be "pom" but is "war" # lu.pgd:WebBusiness:0.0.1-SNAPSHOT, C:\dev\lu\pgd\WebBusiness\0.0.1-SNAPSHOT\WebBusiness-0.0.1-SNAPSHOT.pom, line 7, column 13
[ERROR] Invalid packaging for parent POM lu.pgd:WebBusiness:0.0.1-SNAPSHOT, must be "pom" but is "war" # lu.pgd:WebBusiness:0.0.1-SNAPSHOT, C:\dev\lu\pgd\WebBusiness\0.0.1-SNAPSHOT\WebBusiness-0.0.1-SNAPSHOT.pom, line 7, column 13
#
[ERROR] The build could not read 2 projects -> [Help 1]
[ERROR]
[ERROR] The project lu.pgd:ccpd-ear:0.0.1-SNAPSHOT (C:\Users\x279\workspace\SPDV_EAR\pom.xml) has 1 error
[ERROR] Invalid packaging for parent POM lu.pgd:WebBusiness:0.0.1-SNAPSHOT, must be "pom" but is "war" # lu.pgd:WebBusiness:0.0.1-SNAPSHOT, C:\dev\lu\pgd\WebBusiness\0.0.1-SNAPSHOT\WebBusiness-0.0.1-SNAPSHOT.pom, line 7, column 13
[ERROR] The project lu.pgd:WebBusiness-war:0.0.1-SNAPSHOT (C:\Users\x279\workspace\WebBusiness\pom.xml) has 1 error
[ERROR] Invalid packaging for parent POM lu.pgd:WebBusiness:0.0.1-SNAPSHOT, must be "pom" but is "war" # lu.pgd:WebBusiness:0.0.1-SNAPSHOT, C:\dev\lu\pgd\WebBusiness\0.0.1-SNAPSHOT\WebBusiness-0.0.1-SNAPSHOT.pom, line 7, column 13
Could anybody help me here to understand what is going wrong here please ?
Copy your modules SPDV_EAR and WebBusiness into the parent project folder (ccpd). Then change the modules tag in the parent pom to:
<modules>
<module>SPDV_EAR</module>
<module>WebBusiness</module>
</modules>
Also in your parent pom change
<artifactId>WebBusiness</artifactId>
to
<artifactId>ccpd</artifactId>
In your war (WebBusiness):
<parent>
<groupId>lu.pgd</groupId>
<artifactId>ccpd</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>WebBusiness</artifactId>
In you ear:
<parent>
<groupId>lu.pgd</groupId>
<artifactId>ccpd</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>SPDV_EAR</artifactId>
So your folder names match your project names.
Usually the folder structure for a multi-module project is like this:
- parent-project-folder
- pom.xml (parent-project)
- submodule-project-folder
- pom.xml (submodule-project)
- another-submodule-project-folder
- pom.xml (another-submodule-project)
Then the parent definition you have would be fine, but you have the parent project next to your submodules, so you need to configure a bit more.
Try adding relativePath to your parent specifications:
<parent>
<groupId>...
...
<relativePath>path/to/your/parent/pom.xml</relativePath>
</parent>

Artifactory/JFrog is producing the wrong parent artifactId in generated POM

I have encountered a strange bug while trying to deploy new release builds to my company's JFrog.io (fka: ArtifactoryOnline.com) repository. The project I'm working on has multiple maven modules, all under a single parent. When I upload the JAR files that maven builds to JFrog, the generated POM file is being populated with the incorrect parent artifactId.
I spent a great deal of time and could not find any problems with my company's codebase for the project, so I decided if I could reproduce the error from scratch. Thus I made this throwaway project to demonstrate the bug. For those uninterested in downloading the full project, here are the relevant POM files:
The parent POM, "blueberry":
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.nbyrd</groupId>
<artifactId>blueberry</artifactId>
<packaging>pom</packaging>
<version>1.0</version>
<modules>
<module>blueberryjam</module>
<module>berries</module>
</modules>
</project>
Dependant POM 1: "berries":
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>blueberry</artifactId>
<groupId>org.nbyrd</groupId>
<version>1.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>berries</artifactId>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
Dependant POM 2, "berry-jam":
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>blueberry</artifactId>
<groupId>org.nbyrd</groupId>
<version>1.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>blueberry-jam</artifactId>
<dependencies>
<dependency>
<groupId>org.nbyrd</groupId>
<artifactId>berries</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
</project>
(For what it's worth, all of these POM files were generated in their entirety by JetBrains IntelliJ.)
Pretty straight forward at this point: I have two Maven modules--"berries" and "berry-jam"--that are housed under a central parent module, "blueberry". berry-jam uses berries as a dependency, although I'm not sure if that's relevant to the problem.
When I build the project, I get two JAR files: berries-1.0.jar and berry-jam-1.0.jar. This is as expected. At this point, I would upload these artifacts to Artifactory so that other projects may reference them. And this is where the trouble starts.
When I upload berries-1.0.jar, Artifactory generates the following POM file:
<?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http:// maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>berries</artifactId>
<groupId>org.nbyrd</groupId>
<version>1.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>berries</artifactId>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
As you can see, the generated POM defines the parent artifactId as "berries", which is wrong.
The same problem occurs when I upload berry-jam-1.0.jar:
<?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http:// maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>blueberry-jam</artifactId>
<groupId>org.nbyrd</groupId>
<version>1.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>blueberry-jam</artifactId>
<dependencies>
<dependency>
<groupId>org.nbyrd</groupId>
<artifactId>berries</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
</project>
In both cases, I would expect the parentId to be "blueberry", as it is explicitly stated in both of the child-modules' POM files. These incorrect artifactIds make it impossible to use these libraries. If a third-party application attempts to use these libraries, maven will produce the following warning when downloading dependencies and the build will fail:
[WARNING] The POM for org.nbyrd:berries:jar:1.0 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
This functionality used to work correctly in the past when uploading to Artifactory, so I'm not sure if something has changed in how the tool works or if I have simply done something wrong. Any thoughts?
When you use mvn deploy maven deploys the pom.xmlfile as separated artifact. But when you uploads the jar file with artifactory's web ui and asks artifactory to generate the pom file, I guess it generates it from the data presents in the jar. So the artifactory isn't aware about existing of a parent project.
I had similar problem and my guess was that artifactory is trying to fix pom by changing first artifactId value it can find. Not seeing that it's inside parent node.
So I moved parent node below artifactId/version and that worked for me.
<?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http:// maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>berries</artifactId>
<version>2.0</version>
<parent>
<artifactId>berries</artifactId>
<groupId>org.nbyrd</groupId>
<version>1.0</version>
</parent>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
</project>

maven - advice on usage of multi-modules (jar, war, …) project

I have the following Maven organization:
- ./pom.xml (top-level project, which defines the 4 modules below)
- ./a/pom.xml (library jar)
- ./b/pom.xml (library jar)
- ./c/pom.xml (war)
- ./d/pom.xml (executable jar)
For building and deploying the c project, I do:
mvn verify tomcat7:redeploy -pl c -am
For building and executing the d project, I do:
mvn verify exec:java -pl d -am
For d there is a problem. Maven reports:
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.4.0:java (default-cli)
on project parent: The parameters 'mainClass' for goal
org.codehaus.mojo:exec-maven-plugin:1.4.0:java are missing or invalid -> [Help 1]
This is indeed correct, the parent pom.xml has no configuration for exec. Only the d project has a configuration for exec.
This question is a little variation of question maven - advice on usage of multi-modules (jar, war, ...) project, so I decided to dedicate a separate question for it.
Why does Maven try to exec on the parent project?
update
I abstracted the same problem in following three pom files:
The parent pom:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>test</groupId>
<artifactId>parent</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<name>parent</name>
<modules>
<module>a</module>
<module>b</module>
</modules>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.4.0</version>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
The a pom:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>test</groupId>
<artifactId>parent</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>a</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>a</name>
</project>
The b pom:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>test</groupId>
<artifactId>parent</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>b</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>b</name>
<dependencies>
<dependency>
<groupId>test</groupId>
<artifactId>a</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<configuration>
<mainClass>MyMainClass</mainClass>
</configuration>
</plugin>
</plugins>
</build>
</project>
The command I am executing is:
mvn verify exec:java -pl b -am
This can also be found at https://github.com/jeperjaperjieper/issue-33197130.
I can't cure your problem, but I can give you a recipe. You may have hit a maven issue.
You don't have to use -pl and build from the top every time.
I would expect it to work if you just run 'mvn' (no -pl) at the top; it probably doesn't take very long to build the first pieces.
If you don't want to do that, then you need to run 'mvn install' for the pieces that come first, and then you'll be able to cd into the last piece and build it.
I recommend opening up a JIRA issue for Maven on this; it seems as if you've exposed a problem with -pl, but the best way to find out is to post an issue with a test case and poke the Maven user mailing list.
Try mvn exec:java -Dexec.mainClass="com.example.Main" to run your d project.

compile and test-compile fail

I have two maven projects, one named common and another core. core depends on common. The dependency span both src and test code in core. Here's the file structure:
common/
src/main/java/
...
src/test/java/
...
pom.xml
core/
src/main/java/
...
src/test/java/
...
pom.xml
Common's pom is setup pretty simply:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.uttt.common</groupId>
<artifactId>common</artifactId>
<version>0.1.0</version>
<dependencies>
...
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
...
</plugin>
</plugins>
</build>
</project>
My core's pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.uttt.core</groupId>
<artifactId>core</artifactId>
<version>0.1.0</version>
<dependencies>
...
<dependency>
<groupId>com.uttt.common</groupId>
<artifactId>common</artifactId>
<version>0.1.0</version>
<scope>?</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
...
</plugin>
</plugins>
</build>
</project>
The problem is, when the scope on my dependency on common in core/pom.xml is compile or provided, the compile maven goal passes but test-compile doesn't - with compilation errors in the test code. When the scope is test, the neither goals passes - with compilation errors in the source code.
Anyone have any clues on how to setup my poms such that compile and test-compile succeed?

Categories