[
https://issues.apache.org/jira/browse/CASSANDRA-16597?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17326569#comment-17326569
]
Stefan Miklosovic commented on CASSANDRA-16597:
-----------------------------------------------
The error Mick got above comes from the fact that he the most probably tried to
do this in offline mode.
What happens when a dev is offline, that wrapper downloads an empty jar but
when we are back online, it will not find it because it will not attempt to
download it again (as that file is there, just empty) and empty jar does not
contain any classes ...
We discussed workarounds:
1) Use Ant's task "isreachable"
I do no think this work reliably, under the hood, it uses
InetAddress.isReachable(int) and in my case it just returns false (hence Ant
task always return false)
Quick reproducer:
{code:java}
import java.net.InetAddress;
public class Main
{
public static final void main(String[] args) throws Exception
{
InetAddress address = java.net.InetAddress.getByName("google.com");
// always returns false, this is what Ant task isreachable uses
System.out.println(address.isReachable(5));
}
}
{code}
{code:java}
<condition property="online" value="true" else="false">
<isreachable url="https://www.google.com" timeout="10"/>
</condition>
<target name="abcdef">
<!-- always returns false -->
<echo message="online=${online}"/>
</target>
{code}
In my case (or any variation of that), I was never able to get "true" on the
output. "isReachable" is known to be buggy, after very simple investigation
there is a lot of problems people have with this method of evaluating if a host
is reachable or not hence I think this solution is not applicable to be used in
a heterogeneous environments Cassandra developers work in.
2) Add binary JAR to repository and not try to download it - this is what we
are trying to avoid in a broader sense so that is not applicable too, I would
say
What I came up with is the custom task which would try wrapper's path and if
not successful and its wrapper jar is of size 0, it means that we are offline
as it could not download it so we fallback to system's Maven installation.
I was not able to script this in Ant so I extended ExecTask and did it there
specifically for our usecase.
https://github.com/apache/cassandra/pull/963/commits/ddac95d64131fa495cfbde436fd584e8f1531089
> Introduce Maven wrapper to build for Maven-less build environments
> ------------------------------------------------------------------
>
> Key: CASSANDRA-16597
> URL: https://issues.apache.org/jira/browse/CASSANDRA-16597
> Project: Cassandra
> Issue Type: Improvement
> Components: Build
> Reporter: Stefan Miklosovic
> Assignee: Stefan Miklosovic
> Priority: Normal
> Fix For: 4.0.x
>
> Time Spent: 0.5h
> Remaining Estimate: 0h
>
> With the introduction of CASSANDRA-16391, the build machine needs to have
> Maven installed locally as it executes "mvn" command in its tasks. This might
> be avoided by adding Maven wrapper which would download (and cache) such
> installation so build environment might be completely Maven-less otherwise.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]