Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dependency problem with com.google.guava when using maven as build-tool #5

Closed
marc0olo opened this issue Feb 18, 2019 · 2 comments · Fixed by #38
Closed

dependency problem with com.google.guava when using maven as build-tool #5

marc0olo opened this issue Feb 18, 2019 · 2 comments · Fixed by #38
Assignees
Labels
bug Something isn't working

Comments

@marc0olo
Copy link
Member

Problem

for some reason maven loads guava 18.0 instead of 27.0.1-jre and that leads to the following error:

Exception in thread "main" java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V
	at net.consensys.cava.bytes.ArrayWrappingBytes.<init>(ArrayWrappingBytes.java:39)
	at net.consensys.cava.bytes.Bytes.wrap(Bytes.java:83)
	at net.consensys.cava.bytes.Bytes.wrap(Bytes.java:58)
	at net.consensys.cava.bytes.Bytes.<clinit>(Bytes.java:46)
	at net.consensys.cava.rlp.RLPWriter.writeBigInteger(RLPWriter.java:102)
	at com.kryptokrauts.aeternity.sdk.service.transaction.impl.TransactionServiceImpl.lambda$spendTxNative$0(TransactionServiceImpl.java:96)
	at net.consensys.cava.rlp.AccumulatingRLPWriter.writeList(AccumulatingRLPWriter.java:67)
	at net.consensys.cava.rlp.DelegatingRLPWriter.writeList(DelegatingRLPWriter.java:76)
	at net.consensys.cava.rlp.RLP.encodeList(RLP.java:83)
	at com.kryptokrauts.aeternity.sdk.service.transaction.impl.TransactionServiceImpl.spendTxNative(TransactionServiceImpl.java:87)
	at com.kryptokrauts.aeternity.sdk.service.transaction.impl.TransactionServiceImpl.createSpendTx(TransactionServiceImpl.java:48)
	at AeppsTest.main(AeppsTest.java:60)

Workarounds

  1. include the current guava version in the maven project
  2. use gradle ;-)
@marc0olo marc0olo added the bug Something isn't working label Feb 24, 2019
@mitch-lbw mitch-lbw self-assigned this Mar 12, 2019
@mitch-lbw
Copy link
Member

The problem is class path pollution due to duplicated dependencies to guava transitively coming from the bitcoinj and cava-crypto.
Solution is to use maven dependencyManagement and declare the current version in a uniform manner

<dependencyManagement>
	<dependencies>
		<dependency>
			<groupId>com.google.guava</groupId>
			<artifactId>guava</artifactId>
			<version>27.1-jre</version>
		</dependency>
	</dependencies>
</dependencyManagement>

Add this explanation to the wiki

@marc0olo
Copy link
Member Author

marc0olo commented Jul 7, 2019

@mitch-lbw in order to make sure our SDK always uses the right guava version we explicitely want to add the specific version as dependency in our project so that maven users wouldn't need that workaround

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants