Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > de.comp.lang.java > #13061

Re: Ant an Kompilation hindern?

From Patrick Roemer <sangamon@netcologne.de>
Newsgroups de.comp.lang.java
Subject Re: Ant an Kompilation hindern?
Date 2016-12-20 17:24 +0100
Organization news.netcologne.de
Message-ID <o3bm0f$lv1$1@newsreader4.netcologne.de> (permalink)
References <87pokm7mab.fsf@gmx.net>

Show all headers | View raw


Responding to Оlе Ѕtrеісhеr:
> ich habe einen Quelltextbaum, den ich nur teilweise kompilieren
> möchte. Der Rest steht als jar-Archiv zur Verfügung. Etwa so:
> 
> my/path/p1/C1.java
> my/path/p2/C2.java
> 
> und ein jar, ds C2.class enthält. Im Ant-Target have ich entsprechend
> auch nur C1.java als "includes" eingetragen.
> 
> Wenn C1 aber C2 importiert, dann wird auch C2 neu kompiliert (was nicht
> funktioniert, weil es eine Änderung benötigen würde). Wie kann ich
> erreichen, dass C2 unbedingt aus dem jar genommen und nicht neu
> kompiliert wird, ohne dass ich C2.java lösche? Es hilft jedenfalls
> nichts, es in "excludes" einzutragen.

Der exakte Text Deines Targets wäre hier sinnvoll gewesen.

<snip>
$ tree
.
├── bin
├── build.xml
├── lib
│   └── foo.jar
└── src
    ├── bar
    │   └── C2.java
    └── foo
        └── C1.java

5 directories, 4 files
$ cat src/foo/C1.java
package foo;

public class C1 {}
$ cat src/bar/C2.java
package bar;

import foo.C1;

public class C2 {}
$ jar tf lib/foo.jar
META-INF/
META-INF/MANIFEST.MF
foo/
foo/C1.class
$ cat build.xml
<project name="foobar" default="cmp" basedir=".">

  <target name="cmp">
    <javac
      srcdir="src"
      destdir="bin"
      excludes="foo/C1.java"
      classpath="lib/foo.jar"
      includeantruntime="false"
    />
  </target>

</project>
$ ant
Buildfile: /home/patrick/test/java/antexcl/build.xml

cmp:
    [javac] Compiling 1 source file to /home/patrick/test/java/antexcl/bin

BUILD SUCCESSFUL
Total time: 0 seconds
$ tree bin/
bin/
└── bar
    └── C2.class

1 directory, 1 file
</snip>

Etwa so?

Einen in sich inkonsistenten Sourcebaum halte ich allerdings für eine
äußerst schlechte Idee.

Viele Grüße,
Patrick

Back to de.comp.lang.java | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Ant an Kompilation hindern? ole-usenet-spam@gmx.net (Оlе Ѕtrеісhеr) - 2016-12-20 14:38 +0100
  Re: Ant an Kompilation hindern? Patrick Roemer <sangamon@netcologne.de> - 2016-12-20 17:24 +0100
    Re: Ant an Kompilation hindern? ole-usenet-spam@gmx.net (Оlе Ѕtrеісhеr) - 2016-12-21 13:48 +0100
      Re: Ant an Kompilation hindern? Patrick Roemer <sangamon@netcologne.de> - 2016-12-21 15:44 +0100
        Re: Ant an Kompilation hindern? ole-usenet-spam@gmx.net (Оlе Ѕtrеісhеr) - 2016-12-21 15:52 +0100
          Re: Ant an Kompilation hindern? Patrick Roemer <sangamon@netcologne.de> - 2016-12-21 17:12 +0100

csiph-web