A three-component reaction of aldehyde, (E)-3-aminobut-2-enenitrile and dimedone in ionic liquids, gave 1,4,5,6,7,8-hexahydro-2,7,7-trimethyl-5-oxo-4-arylquinoline-3-carbonitrile derivatives at 50°C. Using 2-hydroxynaphthalene-1,4-dione to replace dimedone at the same reaction conditions resulted in another series of polysubstituted benzo[h]quinoline derivatives in high yields. This method involves the advantages of mild conditions, high yields, one-pot synthesis, and an environmentally benign procedure.