新手求助:从源码构建OpenDaylight Carbon版本步骤指导
Hey there! As someone who’s walked through building ODL Carbon multiple times, let’s fix this issue and get you up and running with a full step-by-step guide. The missing opendaylight/distribution/opendaylight/ directory usually comes from either cloning the wrong repo or skipping a critical build step—let’s cover everything from scratch.
Prerequisites First
Carbon is picky about tool versions, so make sure you have these set up correctly:
- Java 8: Use OpenJDK 1.8.0_151+ or Oracle JDK 1.8.x (Java 9+ will break the build entirely)
- Apache Maven 3.3.9+: Older versions will cause dependency resolution failures
- Git: To pull the official Carbon source code
1. Configure Maven for ODL
ODL relies on its own Maven repositories, so you need to update your Maven settings file (~/.m2/settings.xml). If the file doesn’t exist, create it in your home directory’s .m2 folder. Add this content inside the root <settings> tag:
<profiles> <profile> <id>odl</id> <activation> <activeByDefault>true</activeByDefault> </activation> <repositories> <repository> <id>opendaylight-snapshot</id> <url>https://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/</url> <snapshots> <enabled>true</enabled> </snapshots> <releases> <enabled>false</enabled> </releases> </repository> <repository> <id>opendaylight-release</id> <url>https://nexus.opendaylight.org/content/repositories/opendaylight.release/</url> <snapshots> <enabled>false</enabled> </snapshots> <releases> <enabled>true</enabled> </releases> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>opendaylight-snapshot</id> <url>https://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/</url> <snapshots> <enabled>true</enabled> </snapshots> <releases> <enabled>false</enabled> </releases> </pluginRepository> <pluginRepository> <id>opendaylight-release</id> <url>https://nexus.opendaylight.org/content/repositories/opendaylight.release/</url> <snapshots> <enabled>false</enabled> </snapshots> <releases> <enabled>true</enabled> </releases> </pluginRepository> </pluginRepositories> </profile> </profiles>
2. Clone the Correct Carbon Source Repository
Open your terminal, create a dedicated working directory, and clone the distribution repo (this is where the build generates the runtime package you’re looking for):
mkdir odl-carbon-build && cd odl-carbon-build git clone -b stable/carbon https://git.opendaylight.org/gerrit/p/distribution.git
3. Run the Maven Build
Navigate into the cloned distribution directory and start the build. We skip tests to speed things up (you can remove -DskipTests if you want to run all validation tests, but it’ll add 1-2 hours to the process):
cd distribution mvn clean install -DskipTests
This build can take 30-60 minutes depending on your internet speed (it downloads hundreds of dependencies). Wait until you see a clear BUILD SUCCESS message in the terminal.
4. Locate the Generated ODL Distribution
Once the build finishes, the runtime package will be in this path:distribution/opendaylight/target/
Inside that folder, you’ll find a zip file like opendaylight-0.6.4-Carbon.zip (the exact version number might vary slightly) and a corresponding tar.gz archive. Unzip this file to get your usable ODL instance:
unzip opendaylight-0.6.4-Carbon.zip cd opendaylight-0.6.4-Carbon
5. Start OpenDaylight
From the unzipped directory, launch the ODL Karaf container:
./bin/karaf
Wait 1-2 minutes for all core features to load, then you can access the web UI at http://localhost:8181/index.html (default credentials: admin/admin).
Troubleshooting Your Original Missing Directory Issue
If you didn’t see the expected directory before, it’s almost certainly one of these two issues:
- You cloned the wrong repository (make sure it’s the distribution repo, not odlparent or another subproject)
- The build failed silently—check the Maven output for errors (common culprits: wrong Java version, outdated Maven, or network issues blocking dependency downloads)
内容的提问来源于stack exchange,提问作者sushmita das

