Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Error Compiling Maven Project

 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator

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

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Hi,

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



Kind regards
Karl Heinz Marbaise
 
Praneet Mirchandani
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
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

 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
This question is now the same as your other post. Please don't ask the same question in multiple locations.
https://coderanch.com/t/484676/Ant-Maven-Other-Build-Tools/Error-Compiling-Maven-Project
    Bookmark Topic Watch Topic
  • New Topic