It's hard to find a conclusive answer to this question, and obviously, the construction time varies widely depending on the class of ship we're talking about and the political and military situation in the galaxy at the time.
While conventional armaments were designed for most ships, the two Eclipse-class dreadnoughts had a superlaser as their primary weapon. The bulk of these two Super-class Star Destroyers was built around each ship's reactor and support systems, making them the most powerful conventional warships in history, and causing the design to attract unwanted attention from criminal third parties.
Their construction took over a decade, with the Emperor's downfall leading to delays and shifts in logistics. They were estimated to be powerful enough to allow whoever controlled them a real chance at taking power in the galaxy. This also made them high-profile targets by both the Rebel Alliance, and later, the New Republic. As a symbol of its status, the Eclipse was escorted by smaller Super Star Destroyers during the Battle of Pinnacle Base.
Emperor Palpatine authorized the construction of the first four Executor-class ships even before the Battle of Yavin (0 BBY), but it still had to be slipped past the watchful eyes of various oversight committees in the Imperial Senate; to the very last, the minority of Senators who opposed Palpatine and his policies used the few political tools they had left to hinder him, and one of these was budget oversight. To conceal the particulars of the vessel from the opposition, the Navy listed the new ship as a "Super-class Star Destroyer" in budget reports submitted to the Senate, and understated its true length (19,000 meters) by many kilometers.
The first of the class, the Executor, began construction in the years preceding the Battle of Yavin. The unfinished vessel was used as a headquarters for Darth Vader and his secret apprentice, Galen Marek. With the sudden and unanticipated destruction of the Death Star at Yavin, Wessex's production schedule changed completely. At the urging of Darth Vader, the Emperor ordered her to rush the new line into production as quickly as possible, to compensate for the loss of the battle station. As certain segments of naval command may have anticipated, a new symbol of intimidation was needed, and as Wessex had believed, the Executor-class fit the need well.
The first two Executor-class ships were now being built simultaneously, with the Lusankya at Kuat Drive Yards and the Executor moved to the Fondor Shipyards. Darth Vader received the finished Executor at Fondor about half a year after the fiasco at Yavin. The second ship, then known as the Executor II, was completed shortly afterwards at Kuat, received its new name, and was hidden on Coruscant.
The Executor went on to become the most feared and famous of its class by virtue of its status as Darth Vader's command ship. Because of the Executor's stance as the lead ship of Darth Vader's fleet, Death Squadron, Death Squadron's fleet insignia also bore the image of an Executor-class Star Dreadnought. In addition, four Executor-class Star Dreadnoughts, including the Executor itself, were known to have been in service to the Empire by the time of the Battle of Hoth in 3 ABY. However, the vessel was destroyed at the Battle of Endor in 4 ABY, after an A-wing starfighter rammed through its bridge and it subsequently crashed into the Death Star II.
Darth Vader's personal flagship, the Executor:
Construction on the Executor began under complete secrecy in the secluded Scarl system, where Vader raised and trained Galen Marek1, his secret dark side apprentice, in a failed plan to overthrow Emperor Palpatine as galactic ruler. By 0 ABY, the Executor was transferred to the Starship Yards of Fondor for the final stages of construction, under the overall direction of Admiral Amise Griff. At Fondor, the Executor became the failed target of internal sabotage by a group of traitorous Imperial admirals, who hoped to destroy Vader's project to prevent their own decline in power. Once completed, the Executor made for Yavin 4, site of the Rebel Alliance base. Vader hoped to crush the Rebellion once and for all with his new weapon, but the Executor failed to stop the Rebel evacuation from Yavin, and Griff died in the process.
1 Galen's training began some time after his father's death in 18 BBY, and ended in 3 BBY:
Vader abducted the younger Marek shortly after he killed the boy's father and a squad of stormtroopers in order to keep Galen's existence a secret. Despite his outward loyalty to Palpatine, Vader harbored much hatred toward his Sith Master and intended to overthrow him with Marek as his secret apprentice...
When engaging Vader in a sparring match in 3 BBY, Starkiller expected it to be business as usual afterward. However at the end of it, Vader ordered Starkiller to kneel before him. Believing that his time had come to an end, Starkiller obeyed and waited for death. Instead, Darth Vader formally "knighted" Starkiller, officially recognizing him for the first time as his apprentice, something that Starkiller always believed himself to be. He declared Starkiller's training complete...
Wookieepedia says that most of his training took place aboard the Executor:
Ensconced onboard Vader's incomplete flagship, the Executor, and given the codename "Starkiller", the apprentice repressed all the memories of his previous life and spent the next two decades training as a Sith under Darth Vader's supervision, with the ultimate goal of standing at Vader's side against Palpatine.
The Executor was commissioned in 0.5 ABY and 2.5 ABY. It was destroyed in 4 ABY. Thus, the construction of the Executor must have taken nearly 20 years
The concept for the Death Star could be found in its precursor, the "Expeditionary Battle Planetoid". The concept came about in 29 BBY, around the time of the Second Battle of Zonama Sekot, and the man who came up with the idea for it was Raith Sienar. Sienar made concept designs of the Battle Planetoid, it had a main sphere and two smaller spheres, the smaller spheres were connected to the main sphere by poles, it used massive turbolasers and was powered by an internal plasma implosion core more than a kilometer wide. Unlike its Death Star descendant it lacked a Superlaser, as it was designed for space combat.
Raith showed the designs to the commander of the Republic Outland Regions Security Force, Wilhuff Tarkin. Tarkin was interested in the concept, he later betrayed Sienar when he showed the concept to Supreme Chancellor Palpatine and claimed that he invented it. Sienar was unperturbed, however, as he had already lost interest in the design.
The initial technical design of the Death Star, known at the time as the "Ultimate Weapon", was created by the Geonosian Industries and called for a spheroid battle station capable of destroying Galactic Republic forces and planets under their control.
In 22 BBY, Poggle the Lesser, leader of the Geonosians, returned the top-secret design to Count Dooku to prevent it from falling into the hands of the Jedi during the Battle of Geonosis. Dooku took the designs back to Coruscant and gave them to Darth Sidious, his dark master. These plans would later be fused with Wilhuff Tarkin and Raith Sienar's vision of an Expeditionary Battle Planetoid.
During the Clone Wars, Sidious ordered Geonosian builders to begin construction on the station over their own homeworld. Hundreds of thousands of workers were busy building the station throughout the war. Around five months after the Battle of Geonosis, Dooku briefly considered halting production of the Weapon in favor of the Planet Killer, but changed his mind after the demonstration failed, thanks to sabotage by Mace Windu. 17 months after the start of the war, Geonosian technicians on Zaadja were observed working on the Weapon's design.
In 19 BBY, Supreme Chancellor Palpatine sent the 501st Legion on a mission to Mygeeto where they were to collect an energy sample that would be used in the station's superlaser of the soon to be formed Galactic Empire. During the last few weeks of the war, the Separatist Council debated on ways to prolong the war, to allow their secret weapon time to be finished.
Following the deaths of all the members of the Separatist Council, and the end of the Clone Wars in 19 BBY, a majority of the Separatist holdings were turned over to the newly established Galactic Empire, including the unfinished battlestation. Construction was renewed under Imperial supervision and moved to Despayre in order to secure Palpatine's newly-formed absolute power.
Obviously, the Death Star I was completed by 0 BBY, and destroyed shortly thereafter. From concept to completion, the development of the Death Star I took 29 years, with at least 19 years of actual construction work.
The idea for the second Death Star's development originated as one of two possible scenarios by Bevel Lemelisk and the Imperial Department of Military Research for further development of the Death Star's development, shortly after the completion of the first Death Star. The second Death Star's construction started during the Battle of Yavin, when Emperor Palpatine ordered the construction of new superlasers, to which the resources for its construction, including Hyperspace tugs and treadships, would be sent from their origin near Sullust to Endor via the Silvestri Trace, an obscure hyperspace route. Ironically, he issued this order shortly before the first Death Star's destruction at the hands of Luke Skywalker.
The Death Star II was destroyed in the Battle of Endor, in 4 ABY. From the start of construction to the battle station's destruction - at which time the Death Star II was still incomplete - 4 years passed.
The Millennium Falcon, originally known as YT-1300 492727ZED, was a modified YT-1300 light freighter with a storied history stretching back to the decades before the Clone Wars and the rise of the Galactic Empire. Manufactured by the Corellian Engineering Corporation in 60 BBY, the light freighter was first owned by Corell Industries Limited and underwent several name changes before being bought by the smugglers Kal and Dova Brigger in 48 BBY, and the ship eventually ended up as the property of the secretive Republic Group under the name Stellar Envoy by 29 BBY.
The YT-1300 light freighter designated unit YT 492727ZED was built in 60 BBY by the Corellian Engineering Corporation at Orbital Assembly Facility 7. While still on the assembly line, an accident with a fuel droid sent the freighter rocketing out of control, and the ship almost destroyed the entire assembly line before several workers were able to regain control of the vessel. The ship remained in stock state for several years, and it was first owned by the Corell Industries Limited shipping firm, who possessed the ship for twelve years and utilized it as a shipping vessel in the Corellian system.
Aside from later modifications, the Millennium Falcon appears to have been constructed in less than a year.