一、前置工作
1、因为gephi引用了https://raw.github.com/gephi/gephi/mvn-thirdparty-repo仓库,不幸的是该网站被和谐了,所以需要配置其可访问。
具体步骤可以参考如下网站:https://www.ioiox.com/archives/62.html
PS:如果不想看教程,可以直接参考下面的教程
sudo vim /etc/hosts
添加如下内容(ip可能会换,可以访问https://websites.ipaddress.com/raw.githubusercontent.com查)
185.199.109.133 raw.githubusercontent.com
2、如果maven的setting.xml里镜像可以用阿里云的镜像。
<mirrors>
<mirror>
<id>alimaven</id>
<mirrorOf>central</mirrorOf>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
</mirror>
</mirrors>
<activeProfiles>
<activeProfile>aliyun</activeProfile>
</activeProfiles>
二、编译源码
去官网下载最新源码:
git clone https://github.com/gephi/gephi.git
然后进入源码目录,切换到0.9.2分支,根目录pom文件,repositories修改如下所示:
<repository>
<id>gephi-thirdparty</id>
<url>https://raw.github.com/gephi/gephi/mvn-thirdparty-repo/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>netbeans</id>
<name>NetBeans</name>
<url>http://netbeans.apidesign.org/maven2/</url>
</repository>
执行以下命令:
mvn clean package -Dmaven.test.skip=true
第一次时间略长,经过漫长等待,最终编译成功。
三、GUI操作使用
cd modules/application
mvn nbm:cluster-app nbm:run-platform
就可以使用。
https://github.com/gephi/gephi/wiki/How-to-build-Gephi
How to build Gephi
Follow this guide to start developing the Gephi source code and test your changes.
Introduction
Netbeans Platform
The NetBeans Platform is a generic framework for Swing applications. It provides the “plumbing” that, before, every developer had to write themselves—saving state, connecting actions to menu items, toolbar items and keyboard shortcuts; window management, and so on.
- Description
- Netbeans API Index
- FAQ
Gephi Architecture
Gephi software architecture is modular and therefore each feature is split into modules. Modules depend on each other, and Gephi modules can either depend on other Gephi modules or Netbeans Platform modules. Plugins developers simply create new modules that contains their code, add dependencies to Gephi modules, and distribute their plugins by creating an NBM package. See Gephi APIs documentation to learn more about the API plugins that can be used by modules.
- Gephi APIs documentation
Build Gephi
Requirements
- Java JDK 11 or later
- Apache Maven version 3.2.2 or later
Checkout and Build the sources
Navigate to the desired directory you wish to place the project via terminal, then clone the repository:
git clone https://github.com/gephi/gephi
cd gephi
Gephi uses Maven for building. Each module has its POM.xml
file and there is a gephi-parent
POM file that lists all the modules required to build.
Run this command to build all modules. Note that this process could take some time.
mvn clean install
Run it
Once built, Gephi can be run from the modules/application
folder using a special Maven goal:
Mac/Linux:
>> cd modules/application
>> mvn nbm:cluster-app nbm:run-platform
Windows:
>> cd modules\application
>> mvn nbm:cluster-app nbm:run-platform
Building Gephi in NetBeans
Apache Netbeans is the default IDE to develop Gephi as it natively integrates with the Netbeans Platform. Loading the project is straightforward.
Open Netbeans and go to File > Open Project to look for the Gephi folder. Then, Open Project. Ensure the checkbox “Open Required Projects” is not selected.
Right-click on the project and select Clean and Build.
Next, in the Projects tab of the file navigator, select Gephi > Modules > gephi-app and open the application module.
Finally, select Run from this module.
Troubleshooting
Code changes not taken in account
When you make code changes in a module, make sure to Clean and Build this module before Running Gephi again as otherwise your changes won’t be taken in account.
Building Gephi in IntelliJ IDEA
As Gephi is a Maven project it is well supported by IntelliJ but requires some tweaks to work properly.
Open IntelliJ and open the Gephi folder. You’ll be asked whether you want to Trust this Maven repository. Select Trust Project.
IntelliJ then takes some time to scan the project and resolve dependencies. Once completed, you should see Gephi properly listed as a project in the Project pane.
Then, navigate to IntelliJ’s preferences panel Build, Execution, Deployment > Build Tools > Maven > Runner and select the option Delegate IDE build/run actions to Maven. This is a critical step.
Next in the top-level menu select Build > Build Project.
Once completed, create a run configuration by following Run > Edit Configurations… in the top-level menu.
Here, select Add new configuration and search for Maven.
Next, we’ll configure two things here. Enter nbm:cluster-app nbm:run-platform
into the Command line field and select the modules/application
sub-directory into the Working directory chooser. Give Gephi as name for the configuration.
Finally, you can run Gephi by selecting Run > Run ‘Gephi’ from the top-level menu.
Troubleshooting
Debugging
At this point (IntelliJ 2021.1) debugging doesn’t work out of the box. To enable debugging in IntelliJ follow these steps:
-
Alter your Run configuration and add
-Dnetbeans.run.params.debug=-J-agentlib:jdwp=transport=dt_socket,suspend=n,server=n,address=8000
to the command line, afternbm:cluster-app nbm:run-platform
. -
Create a new Remote JVM Debug Run configuration and select Listen to Remote JVM. Make sure to configure 8000 as the port as well. You can name this configuration Gephi Debug.
Now, start the Gephi Debug by selecting the Debug button. The debugger starts and waits for Gephi to start as well. Then, start Gephi in Debug mode. The debugger should now log Connected to the target VM, address: 'localhost:8000', transport: 'socket'
and properly stop at your breakpoints.