pantsbuild/pants — pull request #148 by ericzundel (2014-05-22 19:43:26+00:00)
Title: Zundel/attempted to inject synthetic reproduces problem we are seeing in our build

We have a lot of rules in our build named "proto". Since the patrick refactor, we aren't able to build. I believe I have reproduced the problem using the protobuf example project:

```
PANTS_DEV=1 ./pants goal bundle src/java/com/pants/examples/protobuf
*** Running pants in dev mode from /Users/zundel/Src/Pants/src/python/pants/bin/pants_exe.py ***

15:39:25 00:00 [main]
See a report at: http://localhost:57641/run/pants_run_2014_05_22_15_39_25_286
15:39:25 00:00 [bootstrap]
15:39:25 00:00 [setup]
15:39:25 00:00 [parse]
15:39:25 00:00 [jvm-locate]
15:39:25 00:00 [jvm-locate]
15:39:25 00:00 [jvm-locate]
15:39:25 00:00 [jvm-locate]
15:39:25 00:00 [jvm-locate]
15:39:25 00:00 [jvm-locate]
15:39:25 00:00 [bootstrap]
15:39:25 00:00 [bootstrap-jvm-tools]
15:39:25 00:00 [gen]
15:39:25 00:00 [thrift]
15:39:25 00:00 [scrooge]
15:39:25 00:00 [protoc]
Invalidated 2 targets containing 2 payload files.
FAILURE
Traceback (most recent call last):
File "/Users/zundel/Src/Pants/src/python/pants/bin/pants_exe.py", line 175, in
main()
File "/Users/zundel/Src/Pants/src/python/pants/bin/pants_exe.py", line 169, in main
_run()
File "/Users/zundel/Src/Pants/src/python/pants/bin/pants_exe.py", line 150, in _run
result = command.run(lock)
File "/Users/zundel/Src/Pants/src/python/pants/commands/goal.py", line 234, in run
return engine.execute(context, self.phases)
File "/Users/zundel/Src/Pants/src/python/pants/engine/engine.py", line 49, in execute
self.attempt(context, phases)
File "/Users/zundel/Src/Pants/src/python/pants/engine/group_engine.py", line 278, in attempt
phase_executor.attempt(explain)
File "/Users/zundel/Src/Pants/src/python/pants/engine/group_engine.py", line 170, in attempt
execute_task(goal, self._tasks_by_goal[goal], self._context.targets())
File "/Users/zundel/Src/Pants/src/python/pants/engine/group_engine.py", line 141, in execute_task
task.execute(targets)
File "/Users/zundel/Src/Pants/src/python/pants/tasks/code_gen.py", line 116, in execute
dependees_by_gentarget.get(target, [])
File "/Users/zundel/Src/Pants/src/python/pants/tasks/protobuf_gen.py", line 132, in createtarget
return self._create_java_target(gentarget, dependees)
File "/Users/zundel/Src/Pants/src/python/pants/tasks/protobuf_gen.py", line 153, in _create_java_target
excludes=target.payload.excludes)
File "/Users/zundel/Src/Pants/src/python/pants/goal/context.py", line 233, in add_new_target
**kwargs)
File "/Users/zundel/Src/Pants/src/python/pants/base/build_graph.py", line 185, in inject_synthetic_target
existing_target=self.get_target(address)))
ValueError: Attempted to inject synthetic derived from JavaProtobufLibrary(BuildFileAddress(src/protobuf/com/pants/examples/trip/BUILD, proto)) into the BuildGraph with address SyntheticAddress(.pants.d/gen/protoc/gen-java:proto), but there is already a Target JavaLibrary(SyntheticAddress(.pants.d/gen/protoc/gen-java:proto)) with that address
```