Index: applications/editors/josm/plugins/terracer/build.xml
===================================================================
--- applications/editors/josm/plugins/terracer/build.xml	(revision 29934)
+++ applications/editors/josm/plugins/terracer/build.xml	(revision 30072)
@@ -2,5 +2,5 @@
 <project name="terracer" default="dist" basedir=".">
     <property name="commit.message" value="applied #j5760 (patch by robome) - Order of housenumbers not correct"/>
-    <property name="plugin.main.version" value="6162"/>
+    <property name="plugin.main.version" value="6397"/>
     <property name="plugin.author" value="Matt Amos"/>
     <property name="plugin.class" value="terracer.TerracerPlugin"/>
Index: applications/editors/josm/plugins/terracer/src/terracer/TerracerAction.java
===================================================================
--- applications/editors/josm/plugins/terracer/src/terracer/TerracerAction.java	(revision 29934)
+++ applications/editors/josm/plugins/terracer/src/terracer/TerracerAction.java	(revision 30072)
@@ -70,4 +70,7 @@
 
     Collection<Command> commands;
+    
+    private Collection<OsmPrimitive> primitives;
+    private TagCollection tagsInConflict;
 
     public TerracerAction() {
@@ -315,5 +318,5 @@
      * @throws UserCancelException 
      */
-    public void terraceBuilding(Way outline,
+    public void terraceBuilding(final Way outline,
                 Node init,
                 Way street,
@@ -457,5 +460,34 @@
         }
 
-        Main.main.undoRedo.add(new SequenceCommand(tr("Terrace"), commands));
+        Main.main.undoRedo.add(new SequenceCommand(tr("Terrace"), commands) {
+            @Override
+            public boolean executeCommand() {
+                boolean result = super.executeCommand();
+                if (result) {
+                    try {
+                        // Build conflicts commands only after all primitives have been added to dataset to fix #8942
+                        List<Command> conflictCommands = CombinePrimitiveResolverDialog.launchIfNecessary(
+                                tagsInConflict, primitives, Collections.singleton(outline));
+                        if (!conflictCommands.isEmpty()) {
+                            List<Command> newCommands = new ArrayList<Command>(commands);
+                            newCommands.addAll(conflictCommands);
+                            setSequence(newCommands.toArray(new Command[0]));
+                            // Run conflicts commands
+                            for (int i = 0; i < conflictCommands.size(); i++) {
+                                result = conflictCommands.get(i).executeCommand();
+                                if (!result && !continueOnError) {
+                                    setSequenceComplete(false);
+                                    undoCommands(commands.size()+i-1);
+                                    return false;
+                                }
+                            }
+                        }
+                    } catch (UserCancelException e) {
+                        // Ignore
+                    }
+                }
+                return result;
+            }
+        });
         if (nb <= 1 && street != null) {
             // Select the way (for quick selection of a new house (with the same way))
@@ -483,8 +515,8 @@
         boolean numberAdded = false;
         if (houseNum != null) {
-            Collection<OsmPrimitive> primitives = Arrays.asList(new OsmPrimitive[]{houseNum, outline});
+            primitives = Arrays.asList(new OsmPrimitive[]{houseNum, outline});
             
             TagCollection tagsToCopy = TagCollection.unionOfAllPrimitives(primitives).getTagsFor(houseNum.keySet());
-            TagCollection tagsInConflict = tagsToCopy.getTagsFor(tagsToCopy.getKeysWithMultipleValues());
+            tagsInConflict = tagsToCopy.getTagsFor(tagsToCopy.getKeysWithMultipleValues());
             tagsToCopy = tagsToCopy.minus(tagsInConflict).minus(TagCollection.from(outline));
             
@@ -492,7 +524,4 @@
                 this.commands.add(new ChangePropertyCommand(outline, tag.getKey(), tag.getValue()));
             }
-            
-            this.commands.addAll(CombinePrimitiveResolverDialog.launchIfNecessary(
-                    tagsInConflict, primitives, Collections.singleton(outline)));
             
             buildingAdded = houseNum.hasKey("building");
