问题
How can I include the Cplex JavaDoc in my maven project to get code assistant on the Cplex Java API?
回答1:
The javadoc can be found here:
{PATH_TO_CPLEX_INSTALLATION_FOLDER}/doc/html/en-US/refjavacplex/html/
For non maven projects you can reference that path directly in the project settings.
For maven projects you can put that files into a javadoc jar file: Open the CommandLine and navigate to the folder, e.g.
cd C:/Program%20Files/IBM/ILOG/CPLEX_Enterprise_Server126/CPLEX_Studio/doc/html/en-US/refjavacplex/html/
Then create the javadoc jar file:
jar cvf cplex-1263-javadoc.jar *
Then put the created javadoc jar next to the CPLEX library jar and a corresponding pom file in your local maven repository, e.g.
{PROJECT_ROOT}\maven_project_repository\ilog\cplex\1263\
- cplex-1263.jar
- cplex-1263-javadoc.jar
- pom.xml
The pom file is for example
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>ilog.concert</groupId>
<artifactId>cplex</artifactId>
<version>1263</version>
</project>
On an update of the Maven Dependencies the javadoc is automatically retrieved together with the API. Set the checkbox for downloading javadoc files in your maven settings if you use Eclipse:
Here are some snippets for including the local maven repository and the CPLEX dependency:
<repositories>
<!-- Custom In-Project repository that contains dependencies that can not
be found on maven servers -->
<repository>
<id>maven_project_repository</id>
<name>Maven Project Repository Share</name>
<url>file://${project.basedir}/maven_project_repository</url>
</repository>
</repositories>
<dependencies>
<!-- cplex -->
<dependency> <!-- from in project maven repository -->
<groupId>ilog.concert</groupId>
<artifactId>cplex</artifactId>
<version>1263</version>
<scope>compile</scope>
</dependency>
</dependencies>
来源:https://stackoverflow.com/questions/38069294/how-to-inlclude-javadoc-for-cplex-api-in-a-maven-project