As we all know, some projects are completely established in the offline mode of the intranet. The first time I came into contact with this offline mode project recently, record the problems encountered:

Maven offline model

Due to the requirements of the intranet, the project is running on a virtual machine, and the development environment cannot be connected to the Internet on the virtual machine, so all projects need to be downloaded again. There was a problem when configuring pom.xml, and idea kept reporting a strange error:

Cannot access maven-default-http-blocker (http://0.0.0.0/) in offline mode

At first, according to the instructions on the Internet, I turned on the offline mode of maven, but it still couldn’t solve the problem. Later, I found out that it was a Maven version problem.

This is because the default Bundled (Maven3) of the idea I use, the maven version here is too high above 3.8, and there is a mirror text in the setting.xml file of the high version maven:

1
2
3
4
5
6
7
<mirror>
<id>maven-default-http-blockerid>
<mirrorOf>external:http:*mirrorOf>
<name>Pseudo repository to mirror external repositories initially using HTTP.name>
<url>http://0.0.0.0/url>
<blocked>trueblocked>
<mirror>

This thing is that maven blocks external HTTP repositories by default, and the simple solution is to comment it out.

If the user does not take the initiative to comment out the maven-default-http-blocker configuration, this will cause persistence problems when IDEA uses the bundled maven.

This is actually a bit inconvenient. The main reason for setting this is to use the HTTP protocol to download dependencies, which may lead to man-in-the-middle attacks. So Maven 3.8.1 prohibits all Maven repositories of the HTTP protocol.

So, there are mainly two solutions:

  1. Downgrade the version
  2. When idea loads the external configuration file, it will first load the settings.xml in the \plugins\maven\lib\maven3\conf folder in the installation directory, and comment the maven-default-http-blocker configuration in this file

idea SVN import project

The project runs on the amazing SVN instead of git. When trying to import a project from SVN, similar to git, we open the interface from idea File -> new -> project from version control:

内网项目踩坑记录

You can see that there is a version control option on the top, and the drop-down menu here can choose subversion (ie SVN).

After selecting, enter the url of the company’s SVN project, and the corresponding folder will be automatically generated, which contains project code, test code, packages and so on. However, problems often occur now, and an error will be reported here:

Cannot run program “svn”: CreateProcess error=2

The reason is that SVN needs to use command-line tools. If there is no SVN command-line tool locally, an error will result.

So reopen the msi file where you installed SVN, select modify (click the picture on the left instead of the text), install the command line client tools and it will be OK.

内网项目