4

I git clone souce code from code.google.com when i set guava-tests module benchmark as maven source root ,but it's also error how to solve it? see the picture
follow Frank advice I change to bechmark maked as a "Test Source Root"
but the Idea dislplay can't resolve symbol BeforeExperiment,but my .m2/repository has the jar .see the first screenshot
. enter image description here enter image description here enter image description here

when i exec ,the result is below ,it is empty.

caliper  jar tf 1.0-beta-1/caliper-1.0-beta-1.jar|grep -E com.google.caliper.BeforeExperiment |sort
caliper  jar tf 0.5-rc1/caliper-0.5-rc1.jar|grep -E com.google.caliper.BeforeExperiment |sort
caliper  jar tf 1.0-beta-1/caliper-1.0-beta-1.jar|grep -E com.google.caliper.BeforeExperiment |sort
fuyou001
  • 1,594
  • 4
  • 16
  • 27
  • Post the complete and exact error message, as text. I can't even see what error you're talking about in your picture. – JB Nizet Aug 19 '13 at 12:39
  • In the second screenshot, the root package (`com`) has a blue folder icon which means you have set it as a "Source Root", when its parent folder (`benchmark`) is already set (correctly) as a "Source Root". Right-click on `com`, "Mark Directory As" / "Unmark as Source Root". – Frank Pavageau Aug 19 '13 at 12:44
  • Actually, `benchmark` should be marked as a "Test Source Root", not a "Source Root". – Frank Pavageau Aug 19 '13 at 12:46
  • @FrankPavageau I change to bechmark maked as a "Test Source Root" – fuyou001 Aug 19 '13 at 14:14

2 Answers2

4

The guava-tests/benchmark directory is currently not set as a source root in the Maven configuration because it won't build. That said, we just need to push a new version of Caliper to Maven Central that includes the new annotations and such, and I think that should be happening sometime soon.

ColinD
  • 108,630
  • 30
  • 201
  • 202
1

No publicly available version of Caliper contains the com.google.caliper.BeforeExperiment class.

You can compare the result of the following class searches on search.maven.org for yourself:

You can also check what's in your jar:

$ jar tf ~/.m2/repository/com/google/caliper/caliper/0.5-rc1/caliper-0.5-rc1.jar | \
    grep -E com.google.caliper.B | sort
com/google/caliper/Benchmark.class
$

Or using the most recent "release" of Caliper:

$ jar tf caliper-1.0-beta-1.jar | grep -E com.google.caliper.B | sort
com/google/caliper/Benchmark.class
$
Frank Pavageau
  • 11,477
  • 1
  • 43
  • 53
  • when i exec the shell.can't find BeforeExperiment.how solve it – fuyou001 Aug 20 '13 at 03:25
  • 1
    That's my point: _you can't_. Google has not released a version of Caliper with that class, the benchmarks are used internally and cannot be built with the publicly available tools & libs. – Frank Pavageau Aug 20 '13 at 07:39
  • 1
    That's not exactly true.... it's in no release, but it's in the git repository already: commit 439ca07, 2013-06-21. – maaartinus Aug 20 '13 at 08:21
  • @maaartinus my bad, I didn't check the available code for Caliper. I think the step-by-step answer to set up the necessary environment (with local modifications to Guava's pom.xml) is a bit out of the SO scope, though... – Frank Pavageau Aug 20 '13 at 08:58
  • No idea how to do it with Maven, etc.; this might get complicated. In Eclipse I simply created a separate project and added it to Java Build Path. – maaartinus Aug 20 '13 at 09:25
  • @maaartinus would you give me the git repository.Thanks! – fuyou001 Aug 22 '13 at 00:56
  • @fuyou001: I can't, as it's not mine. :D But it's free: `git clone https://code.google.com/p/caliper/`, see [here](http://code.google.com/p/caliper/source/checkout). – maaartinus Aug 25 '13 at 13:44