*
The moose likes Ant, Maven and Other Build Tools and the fly likes Error Compiling Maven Project Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Reply locked New topic
Author

Error Compiling Maven Project

Praneet Mirchandani
Ranch Hand

Joined: Dec 16, 2009
Posts: 46

Hi,

I am trying to build my project using Maven. When I run mvn compile on the command prompt, these are some errors I get:

1. package org.apache.commons.logging does not exist.
2. package oracle.jdbc does not exist.
3. package org.apache.log4j does not exist.
4. package oracle.sql does not exist.

I have included the jar for commons logging in the Build Path of the project. (I am using Eclipse as the IDE)

Any idea whats wrong here?

Thanks,
Praneet


Thanks,
Praneet
Karl Heinz Marbaise
Greenhorn

Joined: Aug 12, 2007
Posts: 19
Hi,

you have to add the appropriate dependencies which are needed e.g. commons-logging...



Kind regards
Karl Heinz Marbaise


Software Configuration Management (Subversion, CVS, SVK etc.) http://www.skmwiki.de/
Subversion Repository Search Engine http://www.supose.org/
Praneet Mirchandani
Ranch Hand

Joined: Dec 16, 2009
Posts: 46
Thanks a lot for your reply Karl.

I added the dependencies in pom.xml. It is still showing me errors while compiling.


I have added the repositories in pom.xml, cant figure out how to work around this.

Here is the error log:

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building PricingCore
[INFO] task-segment: [compile]
[INFO] ------------------------------------------------------------------------
[INFO] [resources:resources {execution: default-resources}]
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources,
i.e. build is platform dependent!
[INFO] Copying 4 resources
[WARNING] POM for 'javax.mail:mail:pom:1.4:compile' is invalid.

Its dependencies (if any) will NOT be available to the current build.
[WARNING] POM for 'javax.jms:jms:pom:1.1:compile' is invalid.

Its dependencies (if any) will NOT be available to the current build.
[WARNING] POM for 'com.sun.jdmk:jmxtools:pom:1.2.1:compile' is invalid.

Its dependencies (if any) will NOT be available to the current build.
[WARNING] POM for 'com.sun.jmx:jmxri:pom:1.2.1:compile' is invalid.

Its dependencies (if any) will NOT be available to the current build.
Downloading: http://repo1.maven.org/ojdbc/ojdbc/14/ojdbc-14.jar
[INFO] Unable to find resource 'ojdbc:ojdbc:jar:14' in repository repo1 (http://
repo1.maven.org)
Downloading: http://repo2.maven.org/ojdbc/ojdbc/14/ojdbc-14.jar
[INFO] Unable to find resource 'ojdbc:ojdbc:jar:14' in repository repo2 (http://
repo2.maven.org)
Downloading: http://repo1.maven.org/maven2/ojdbc/ojdbc/14/ojdbc-14.jar
[INFO] Unable to find resource 'ojdbc:ojdbc:jar:14' in repository central (http:
//repo1.maven.org/maven2)
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.

Missing:
----------
1) ojdbc:ojdbc:jar:14

Try downloading the file manually from:
http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/index.html

Then, install it using the command:
mvn install:install-file -DgroupId=ojdbc -DartifactId=ojdbc -Dversion=14 -
Dpackaging=jar -Dfile=/path/to/file

Alternatively, if you host your own repository you can deploy the file there:

mvn deploy:deploy-file -DgroupId=ojdbc -DartifactId=ojdbc -Dversion=14 -Dp
ackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

Path to dependency:
1) com.wellmanage.pricing:PricingCore:jar:1.0-SNAPSHOT
2) ojdbc:ojdbc:jar:14

----------
1 required artifact is missing.

for artifact:
com.wellmanage.pricing:PricingCore:jar:1.0-SNAPSHOT

from the specified remote repositories:
central (http://repo1.maven.org/maven2),
repo2 (http://repo2.maven.org),
repo1 (http://repo1.maven.org)



[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9 seconds
[INFO] Finished at: Fri Feb 26 12:34:28 GMT+05:30 2010
[INFO] Final Memory: 5M/10M
[INFO] ------------------------------------------------------------------------


Here is the 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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.wellmanage.pricing</groupId>
<artifactId>PricingCore</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>PricingCore</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.15</version>
</dependency>
<dependency>
<groupId>ojdbc</groupId>
<artifactId>ojdbc</artifactId>
<version>14</version>
</dependency>

</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
</build>

<repositories>
<repository>
<id>repo1</id>
<url>http://repo1.maven.org</url>
</repository>
<repository>
<id>repo2</id>
<url>http://repo2.maven.org</url>
</repository>
</repositories>

</project>

Please help.

Thanks,
Praneet

Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5812
    
    7

This question is now the same as your other post. Please don't ask the same question in multiple locations.
http://www.coderanch.com/t/484676/Ant-Maven-Other-Build-Tools/Error-Compiling-Maven-Project


JBoss In Action
 
 
subject: Error Compiling Maven Project
 
Similar Threads
Can we turn on and off the servlets in web.xml?
How to auto deploy to weblogic using maven
Maven 1.0.2 & eclipse: "build-all does not exist"
importing files in nebeans
Help with a Build Error