I am new to pom but went through the "Getting started" on maven.apache.org and also referred to an existing project within the company before i started on this project.
Info:
If i specify the jars as referenced libs in eclipse the project is running smooth and no issues are observed.
Problem: compilation errors since unable to download dependent code from repository.
My project structure is [simplified for easier understanding]
utils
utils/commons
[has source in src/main/java style] [uses package org.apache.commons.io.IOUtils
]
utils/commons/pom.xml
utils/pom.xml
[parent]
Now I began with commons folder to write the pom.xml as the only module and no reference to any parent / other module.
After I ran mvn install
it gave errors as
ToolUtils.java:[17,28] error: package org.apache.commons.io does not exist
ToolUtils.java:[18,23] error: package org.apache.log4j does not exist
If i commented the code which was using org.apache.commons.io.IOUtils
then the mvn install
works fine and generates a jar.
I looked up the net and found that the issue is failing to locate the repository so i updated the reference
to parent pom.xml.
And also included the repositories details in the parent pom.xml. [which is directly under utils folder]
I am still getting the same error and the build does not move further.
ToolUtils.java:[17,28] error: package org.apache.commons.io does not exist
ToolUtils.java:[18,23] error: package org.apache.log4j does not exist
I am using an internal URL which i have verified manually in a broswer.
Also I have verified that the proxy details are correct since another old project refers to the same URL and is getting built properly.
[Unfortunately the project is far too complex to copy paste the pom.xml and modify ,
hence writing the pom.xml from scratch.]
Can some point what am i missing which causes no download from repository ?
Thanks in advance.
Any help would be deeply appreciated.
Note:
1) I am pasting snippets from the 2 different pom.xml with their directory names for easier identification. Attachments can be provided on request.
2) I have modified the references to confidential data across to protect some identities.
utils/common/pom.xml [commons module]
....
<parent>
<groupId>com.osg.rtos</groupId>
<artifactId>rxutils</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
....
<dependencyManagement>
<dependencies>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
<dependency>
<groupId>com.osg.rtos</groupId>
<artifactId>rtos-commons-service</artifactId>
<version>${rtos.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
utils/pom.xml [parent]
....
<groupId>com.osg.rtos</groupId>
<artifactId>rxutils</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>rxutils</name>
<packaging>pom</packaging>
<repositories>
<repository>
<id>release</id>
<url>http://internal.com/~devbuild/repository</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>com.osg.rtos</groupId>
<artifactId>rtos-commons-service</artifactId>
<version>${rtos.version}</version>
</dependency>
<dependency>
<groupId>com.osg.rtos</groupId>
<artifactId>rtos-data</artifactId>
<version>${rtos.version}</version>
</dependency>
<dependency>
<groupId>com.osg.rtos</groupId>
<artifactId>rtos-exception</artifactId>
<version>${rtos.version}</version>
</dependency>
<dependency>
<groupId>com.osg.rtos</groupId>
<artifactId>rtos-mailbox-service</artifactId>
<version>${rtos.version}</version>
</dependency>
<dependency>
<groupId>com.osg.rtos</groupId>
<artifactId>rtos-message-service</artifactId>
<version>${rtos.version}</version>
</dependency>
<dependency>
<groupId>com.osg.rtos</groupId>
<artifactId>rtos-rest</artifactId>
<version>${rtos.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<modules>
<module>commons</module>
<module>rxutils</module>
<module>tool</module>
</modules>
...