Package org.apache.tools.ant

Examples of org.apache.tools.ant.BuildException


    public void execute() throws BuildException
    {
        if (dirName == null)
        {
            final String message = Messages.getString("vfs.tasks/no-directory-specified.error");
            throw new BuildException(message);
        }

        try
        {
            final FileObject dir = resolveFile(dirName);
            final String message = Messages.getString("vfs.tasks/mkdir.create-folder.info", dir);
            log(message);
            dir.createFolder();
        }
        catch (final FileSystemException e)
        {
            throw new BuildException(e);
        }
    }
View Full Code Here


            log("Details of " + file.getName().getURI());
            showFile(file, INDENT);
        }
        catch (final Exception e)
        {
            throw new BuildException(e);
        }
    }
View Full Code Here

                    +bpInfo.getProvidedPackageVersionSource(packageName)
                    +") states '" +piVersion.toString()
                    +"' but the <exportpackage> element says '"
                    +epVersion.toString() +"'.";
                  log(msg, Project.MSG_ERR);
                  throw new BuildException(msg);
                }
              } catch (IllegalArgumentException iae) {
                final String msg = "Invalid version '" +epVersionS
                  +"' in <exportpackage name=\""+packageName +"\" ...>: "
                  +iae.getMessage();
                log(msg, Project.MSG_ERR);
                throw new BuildException(msg, iae);
              }
            }
          }
        }
      }

      final SortedSet privatePackages = bpInfo.getProvidedPackages();
      privatePackages.removeAll(publicPackages);

      final SortedSet referencedPackages = bpInfo.getReferencedPackages();
      referencedPackages.removeAll(privatePackages);
      for (Iterator iterator = referencedPackages.iterator();
           iterator.hasNext();) {
        final String packageName = (String) iterator.next();
        if (!isStandardPackage(packageName) &&
            !importPackage.containsKey(packageName)) {
          if (packageAnalysis == PACKAGE_ANALYSIS_AUTO) {
            final String version = (String) exportPackage.get(packageName);
            try {
              importPackage.put(packageName, toImportRange(version));
            } catch (IllegalArgumentException iae) {
              final String msg = "Invalid version value, '" +version
                +"' for exported package \""+packageName
                +"\" can not derive version range for auto-import. "
                +iae.getMessage();
              log(msg, Project.MSG_ERR);
              throw new BuildException(msg, iae);
            }
          } else if (packageAnalysis == PACKAGE_ANALYSIS_WARN) {
            log("Referenced package not found in bundle or imports: "
                +packageName,
                Project.MSG_WARN);
View Full Code Here

        }
        ze = jarStream.getNextEntry();
      }
    } catch (Exception e) {
      e.printStackTrace();
      throw new BuildException("Failed to analyze class-file " +
                               res + ", exception=" + e, getLocation());
    }
  }
View Full Code Here

      asmAnalyser.analyseClass(res.getInputStream(), res.toString());
    } catch (BuildException be) {
      throw be;
    } catch (Exception e) {
      e.printStackTrace();
      throw new BuildException("Failed to analyze class-file "
                               +res + ", exception=" + e,
                               getLocation());
    }
  }
View Full Code Here

    } else if (PACKAGE_ANALYSIS_WARN.equals(packageAnalysis)) {
      this.packageAnalysis = PACKAGE_ANALYSIS_WARN;
    } else if (PACKAGE_ANALYSIS_AUTO.equals(packageAnalysis)) {
      this.packageAnalysis = PACKAGE_ANALYSIS_AUTO;
    } else {
      throw new BuildException("Illegal value: " + packageAnalysis);
    }
  }
View Full Code Here

    if (name != null && prefix == null) {
      bpInfo.addProvidedPackage(name);
    } else if (prefix != null && name == null) {
      standardPackagePrefixes.add(prefix);
    } else {
      throw new BuildException("StandardPackage must have exactly one of the name and prefix attributes defined");
    }
  }
View Full Code Here

  }

  public void addConfiguredImportPackage(OSGiPackage osgiPackage) {
    final String name = osgiPackage.getName();
    if (name == null) {
      throw new BuildException("ImportPackage must have a name");
    } else if (osgiPackage.getPrefix() != null) {
      throw new BuildException("ImportPackage must not have a prefix attribute");
    } else {
      importPackage.put(name, osgiPackage.getVersion());
    }
  }
View Full Code Here

  }

  public void addConfiguredExportPackage(OSGiPackage osgiPackage) {
    final String name = osgiPackage.getName();
    if (name == null) {
      throw new BuildException("ExportPackage must have a name");
    } else if (osgiPackage.getPrefix() != null) {
      throw new BuildException("ExportPackage must not have a prefix attribute");
    } else {
      exportPackage.put(name, osgiPackage.getVersion());
    }
  }
View Full Code Here

      // TODO: better merge may be needed, currently overwrites
      // pre-existing headers
      addConfiguredManifest(generatedManifest);
    } catch (ManifestException me) {
      throw new BuildException("Error merging manifest headers", me);
    }
    super.execute();
  }
View Full Code Here

TOP

Related Classes of org.apache.tools.ant.BuildException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.