Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ and Perforce Integration: Client Spec issue when using Project structure outside of client spec root

I want to use IntelliJ in the following manner. A Project (akin to Eclipse workspace) that contains multiple modules (akin to Eclipse Projects). As you can guess I am moving over to IntelliJ from a more recent Eclipse background.

I set up an empty project called MainProject which appears in the dir structure:

  • C:\IntelliJProjects\MainProject

This correctly contains my ".idea" directory. I want this to stay out of source control and on the C drive.

I then added two Java modules, one for each component within the project that I will work on. These are in perforce and under a p4 client spec with a root

  • V:\dev

("V" is a network drive that the code has to live on but I do not want the IntelliJ project files to live there). The two modules have a content root

  • v:\dev\component1\trunk\src
  • v:\dev\component2\trunk\src

This all works ok. I have marked the content correctly in the module, src, test etc

Now for the issue. When I try to set up perforce the project root is:

  • C:\IntelliJProjects\MainProject

but the client spec root is

  • v:\dev

so I get the following error when I test the connection

<pre>
Connection problems: </br>
 Wrong client specification: </br>
 Client roots: </br>
  v:\dev </br>
 Actual root: </br>
  C:\IntelliJProjects\MainProject </br>
</pre>

When using Eclipse, Perforce has never been concerned with where the Eclipse workspace is so likewise I was not expecting IntelliJ to be concerned with where the project file is stored. I can see many cases where you would not want the project or indeed the module .iml files under perforce but the code certainly would be.

The only way around this would be to have the project file on the network drive under the client spec but as it is at the project level it could not rightly live under either:

  • v:\dev\component1
  • v:\dev\component2

so I would have a project under

  • v:\dev

which would break if I ever altered client specs

The only other way I have figured out is that I add

  • v:\dev

as a directory under "Version Control" where you can add in directories

  • has no VCS
  • v:\dev has VCS defined as perforce

Is this the only way or can anyone advise a better approach?

like image 654
user3191016 Avatar asked Feb 14 '23 03:02

user3191016


2 Answers

I know this is an old question, but i'm having the same problem now and i managed to solve it.

I have an IntelliJ project in a folder A, while my Perforce workspace is in folder B.

In my project i have both modules inside the project folder and inside the Perforce workspace, and i was having the "Wrong client specification" error as i mapped the whole project to Perforce.

All i had to do was to go to: IntelliJ project preferences -> Version Control click on the + and add map my entire Perforce workspace directory to Perforce as a VCS, as in the picture: enter image description here

like image 136
matteosilv Avatar answered Apr 29 '23 03:04

matteosilv


Your setting is correct. If you map whole "Project" to Perforce VCS, IDEA will consider everything in your project (including .idea) to be under Perforce, which is not what you want.

BTW it's strongly advised to keep project source on local disks, otherwise IDEA might have issues with file synchronization or just might function slower than it could be.

like image 26
Peter Gromov Avatar answered Apr 29 '23 02:04

Peter Gromov