Bug 70914 - devel/apache-ant ignores JAVA_HOME when reinstall
Summary: devel/apache-ant ignores JAVA_HOME when reinstall
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Herve Quiroz
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-08-24 20:10 UTC by Rong-En Fan
Modified: 2004-11-07 00:53 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rong-En Fan 2004-08-24 20:10:29 UTC
	devel/apache-ant ignores JAVA_HOME when make reinstall

Fix: 

I have report similar situation on java/eclipse before,
	the pr is 
	http://www.freebsd.org/cgi/query-pr.cgi?pr=65479

	and that seems fixed. I think that might be a way
	to fix this.
How-To-Repeat: 	cd /usr/ports/devel/apache-ant
	make clean && make JAVA_HOME=/usr/local/jdk1.4.1 install
	[...]
	===>   apache-ant-1.6.2 depends on file: /usr/local/jdk1.4.1/bin/java - found
	it's good..

	make clean && make JAVA_HOME=/usr/local/jdk1.4.1 reinstall
	[...]
	===>   apache-ant-1.6.2 depends on file: /usr/local/diablo-jdk1.3.1/bin/java - not found

	It complete ignores JAVA_HOME as it try to use the
	default JAVA_HOME which is diablo-jdk1.3.1
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2004-08-25 07:02:38 UTC
Responsible Changed
From-To: freebsd-ports-bugs->znerd

Over to maintainer.
Comment 2 Herve Quiroz freebsd_committer 2004-08-27 12:09:18 UTC
Responsible Changed
From-To: znerd->hq

I'll handle this since it's related to bsd.java.mk.
Comment 3 Herve Quiroz freebsd_committer 2004-08-27 12:17:57 UTC
Rong-En,

Specifying JAVA_HOME is a deprecated feature. Using bsd.java.mk 2.0, you
shouldn't use JAVA_HOME to enforce a particular JDK.

In fact, what intrigues me is your first test statement. Specifying
JAVA_HOME shoudn't have any impact on the behvaiour of the port. This
port is on my TODO list for many reasons, among which bsd.java.mk 2.0
compliance. I hope we may get rid of this issue this way.

FYI, if you want to enforce a particular JDK (provided of course that
this JDK matches the requirements of the port), you may use
JAVA_PREFERRED_PORTS. Altough this feature is not (yet) documented, you
may take a look at bsd.java.mk itself to get the name of JDK ports in
order to customize the behaviour of Java ports. For instance, what
you're trying to do in your first statement should be possible with the
following:

make [re]install JAVA_PREFERRED_PORTS=JAVA_PORT_NATIVE_BSDJAVA_JDK_1_4

I'll investigate a bit further to determine if this does actually need
to be fixed. OTOH, maybe we could just warn users using a custom
JAVA_HOME so they are aware that this won't have any effect (You may
notice from line 379 that JAVA_HOME will get overriden in bsd.java.mk
anyway). Still this is a relevant issue IMHO as I don't understand yet
why user-set JAVA_HOME is taken into account in first statement.

Herve
Comment 4 Rong-En Fan 2004-09-07 14:03:24 UTC
Sorry for late reply. I'm so busying these days.

On Fri, Aug 27, 2004 at 01:17:57PM +0200, Herve Quiroz wrote:
> Rong-En,
> 
> Specifying JAVA_HOME is a deprecated feature. Using bsd.java.mk 2.0, you
> shouldn't use JAVA_HOME to enforce a particular JDK.

Is current bsd.java.mk 2.0?

> FYI, if you want to enforce a particular JDK (provided of course that
> this JDK matches the requirements of the port), you may use
> JAVA_PREFERRED_PORTS. Altough this feature is not (yet) documented, you
> may take a look at bsd.java.mk itself to get the name of JDK ports in
> order to customize the behaviour of Java ports. For instance, what
> you're trying to do in your first statement should be possible with the
> following:
> 
> make [re]install JAVA_PREFERRED_PORTS=JAVA_PORT_NATIVE_BSDJAVA_JDK_1_4

This sounds nice, but when I tried this:

make install JAVA_PREFERRED_PORTS=JAVA_PORT_NATIVE_BSDJAVA_JDK_1_4
===>  Installing for apache-ant-1.6.2
===>   apache-ant-1.6.2 depends on executable: classpath - found
===>   apache-ant-1.6.2 depends on file: /usr/local/jdk1.4.2/bin/java - not found
===>    Verifying install for /usr/local/jdk1.4.2/bin/java in /usr/ports/java/jdk14

However, I have jdk-1.4.1p4 installed which is in
/usr/local/jdk1.4.1. Is there any way to deal with it?
How about something like:

make install JAVA_PORT=jdk-1.4.1p4

which uses the ORIGIN and find the correct location of
java/javac?

> I'll investigate a bit further to determine if this does actually need
> to be fixed. OTOH, maybe we could just warn users using a custom
> JAVA_HOME so they are aware that this won't have any effect (You may

This is a good idea.

> notice from line 379 that JAVA_HOME will get overriden in bsd.java.mk
> anyway). Still this is a relevant issue IMHO as I don't understand yet
> why user-set JAVA_HOME is taken into account in first statement.

FYI, in my previous pr about eclipse, it seems that
JAVA_HOME in install/reinstall takes into account.
Comment 5 Hervé Quiroz 2004-11-03 02:56:30 UTC
Rong-En,

On Tue, Sep 07, 2004 at 09:03:24PM +0800, Rong-En Fan wrote:
> Is current bsd.java.mk 2.0?

Yes it is. The CVS revision is actually 1.56 but the current flavor of
bsd.java.mk is called "2.0" as it has been refactored and the API has
slightly changed.

> This sounds nice, but when I tried this:
> 
> make install JAVA_PREFERRED_PORTS=JAVA_PORT_NATIVE_BSDJAVA_JDK_1_4
> ===>  Installing for apache-ant-1.6.2
> ===>   apache-ant-1.6.2 depends on executable: classpath - found
> ===>   apache-ant-1.6.2 depends on file: /usr/local/jdk1.4.2/bin/java - not found
> ===>    Verifying install for /usr/local/jdk1.4.2/bin/java in /usr/ports/java/jdk14
> 
> However, I have jdk-1.4.1p4 installed which is in
> /usr/local/jdk1.4.1. Is there any way to deal with it?
> How about something like:
> 
> make install JAVA_PORT=jdk-1.4.1p4
> 
> which uses the ORIGIN and find the correct location of
> java/javac?

I see. It seems like what you are trying to do is to install ports from
a recent ports tree with an un-upgraded (and quite old actually) jdk.

Although it could work, tracking the ORIGIN as you suggest would be
quite complex to implement. I've been discussing this issue with Greg
Lewis and we decided we cannot decently support such feature.

Greg suggested that you use an old version of bsd.java.mk (or patch it
to overrride the location of your installed JDK). I just found out that
you may also use the following trick:

$ make _JAVA_PORT_NATIVE_BSDJAVA_JDK_1_4_INFO="PORT=java/jdk14 \
    HOME=/usr/local/jdk1.4.1 VERSION=1.4.1 OS=native VENDOR=bsdjava" install

This will actually override JDK port metainfo and you'll get the
behavior you expect. Maybe having this same statement in /etc/make.conf
would do the trick.

> > I'll investigate a bit further to determine if this does actually need
> > to be fixed. OTOH, maybe we could just warn users using a custom
> > JAVA_HOME so they are aware that this won't have any effect (You may
> 
> This is a good idea.
> 
> > notice from line 379 that JAVA_HOME will get overriden in bsd.java.mk
> > anyway). Still this is a relevant issue IMHO as I don't understand yet
> > why user-set JAVA_HOME is taken into account in first statement.
> 
> FYI, in my previous pr about eclipse, it seems that
> JAVA_HOME in install/reinstall takes into account.

After further investigation, I found out that having JAVA_HOME defined
(either passed through command-line make arguments or from environement)
actually does have some effect, but a nasty one. I have got a patch to
implement stronger error checking in this extend.

Herve
Comment 6 Herve Quiroz freebsd_committer 2004-11-07 00:52:34 UTC
State Changed
From-To: open->closed

A patch to implement stronger error checking has been commited (bsd.java.mk 
revision 1.57).