aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes Compiling with Ant: Package does not exist 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
Bookmark "Compiling with Ant: Package does not exist" Watch "Compiling with Ant: Package does not exist" New topic

Compiling with Ant: Package does not exist

M. Dooze

Joined: Oct 29, 2007
Posts: 6
I have read most of the post here about PACKAGE DOES NOT EXIST but I still cant find a solution to my problem..please see below for a description of the problem

Perforce, Eclipse-Europa, Ant 1.7

1.I am working on two different platforms with two different eclipse workspaces.
2.I build some of the code on platform x2 and import the jar into platform x1 in Eclipse and then compile with ant each time on both platforms.
3.I have a jar file call it x2.jar from platform x2 in which I have an Interface that I want to use on the x1 side. Please don�t ask about this design, this is how I met the company code and I have to work with it like that.

Everything was compilling and working fine even after I had made code changes on both platforms, I was testing and after making more changes on the x2 side I cleaned and recompile fine on x2 side when I can to the x1 side, that�s when things started---This has been going on for days now and I�m getting worried!

Here is the Ant output

[echo] ************************************************************
[echo] * Building wsglogin component..
[echo] ************************************************************

[mkdir] Created dir: C:\projects\Platform1Shim\components\wsglogin\build
[mkdir] Created dir: C:\projects\Platform1Shim\stage\wsglogin
[mkdir] Created dir: C:\projects\Platform1Shim\stage\wsglogin-client
[mkdir] Created dir: C:\projects\Platform1Shim\components\wsglogin\build\classes

[javac] Compiling 12 source files to C:\projects\Platform1Shim\components\wsglogin\build\classes
[javac] C:\projects\Platform1Shim\components\wsglogin\server\client\ package com.wsgatewaylogin does not exist �this package comes from the x2 branch
[javac] import com.wsgatewaylogin.IGateway;
[javac] ^
[javac] C:\projects\Platform1Shim\components\components\wsglogin\server\client\ cannot find symbol
[javac] symbol: class IGateway

[javac] public class GatewayLogin implements IGateway{
[javac] ^
[javac] 2 errors

C:\projects\Platform1Shim\build.xml:220: The following error occurred while executing this line:
C:\projects\Platform1Shim\src\components\wsglogin\build.xml:110: Compile failed; see the compiler error output for details.

Total time: 3 minutes 43 seconds

Here�s a part of build.xml on the x1 side showing line 110
I made new additions to the file while trying to solve the problem but it doesn�t help.

<?xml version="1.0"?>

<!-- ======================================================================= -->
<!-- build file -->
<!-- ======================================================================= -->

<project name="wsglogin" default="ejbjar" basedir=".">

<property file="../"/>
<property environment="env"/>

<property name="src.dir" value="${basedir}/src"/>
<property name="build.dir" value="${basedir}/build"/>
<property name="build.classes.dir" value="${build.dir}/classes"/>
<property name="dev.root" value="../../.."/>
<property name="dist.dir" value="${dev.root}/stage/wsglogin"/>
<property name="client.dist.dir" value="${dev.root}/stage/wsglogin-client"/>
<property name="stage.dir" value="${dev.root}/stage"/>
<property name="conf.dir" value="${src.dir}/conf"/>
<property name="components.dir" value="../../components"/>
<property name="thirdparty.dir" value="../../../thirdparty"/>
<property name="p2.dir" value="../../../../../../Source-Branches/Platform2-1.1"/>
<property name="jboss.dir" value="${thirdparty.dir}/jboss-4.0.5/client"/>
<!-- <property name="jboss.home" value="C:/software/jboss-4.0.5.GA"/> -->

<!-- Build classpath -->
<path id="classpath">

<fileset dir="${dev.root}/stage/syncservice">
<include name="**/*.jar"/>
<fileset dir="${p2.dir}/build/distribution"> --This is the location of the jar that has the package which cannot be found
<include name="**/*.jar"/>
<!-- new addition by me-->
<include name="core2-wsgatewaylogin.jar"/> --this is the name of that jar. I tried to force it to get seen but still no luck!
<!-- end new addition-->
<fileset dir="${p2.dir}/compile-lib">
<include name="**/*.jar"/>
<fileset dir="${p2.dir}/lib">
<include name="**/*.jar"/>
<fileset dir="${p2.dir}/lib/jboss">
<include name="**/*.jar"/>
<fileset dir="${p2.dir}/lib/xfire">
<include name="**/*.jar"/>

<fileset dir="${p2.dir}/lib/axis">
<include name="**/*.jar"/>

<!-- new addition-->
<fileset dir="${thirdparty.dir}/bouncycastle/lib">
<include name ="bcprov-jdk14-116.jar"/>

<fileset dir="${thirdparty.dir}/apache/log4j/dist/lib">
<include name ="log4j.jar"/>

<fileset dir="${thirdparty.dir}/sun/j2ee/lib">
<include name ="j2ee.jar"/>
<!-- end new addition-->

<fileset dir="${thirdparty.dir}/junit/junit3.8.1">
<include name="**/*.jar"/>

<fileset dir="${jboss.dir}">
<include name="**/*.jar"/>

<fileset dir="${jboss.home}/client">
<include name="**/*.jar"/>
<fileset dir="${jboss.home}/server/all/lib">
<include name="**/*.jar"/>

<pathelement location="${build.classes.dir}"/>

<!-- =================================================================== -->
<!-- Prepares the build directory -->
<!-- =================================================================== -->
<target name="prepare">
<mkdir dir="${build.dir}"/>
<mkdir dir="${dist.dir}"/>
<mkdir dir="${client.dist.dir}"/>
<mkdir dir="${build.classes.dir}"/>

<!-- =================================================================== -->
<!-- Compiles the source code -->
<!-- =================================================================== -->
<target name="compile" depends="prepare">
<javac srcdir="${src.dir}"
includes="**"> line 110 is here�this is where the failure is occurring since the package cannot be found!
<classpath refid="classpath"/>

Java is another world!
Ilja Preuss

Joined: Jul 11, 2001
Posts: 14112
Two ideas:

- take a look into the jar file to see whether it actually contains the expected package in the correct folder structure

- run ant with the -v option (or was it -d?) to see whether ant finds the specified classpath.

The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Consider Paul's rocket mass heater.
subject: Compiling with Ant: Package does not exist
Similar Threads
JNDI properties for JBoss 4.2.2
${env.JBOSS_HOME}\client not found.
Error in connecting client application with EJB deployed in JBOSS
stateless session bean
Build failed- ejb3.deployer not found