At present, in the development process, the same project needs to use more than one language problem, if the creation of different projects need to be integrated, very inconvenient,
Later I wanted to do a multi language interactive development under the same project.
By finding the appropriate solution to eclipse's research, share it.
Why there is such an idea, because in the use of the hive process, for different business scenarios, there are Java code to write UDF, Python code processing scripts, etc., if divided into different projects, in the later integration of the feel inconvenient, How to make a simple switch in eclipse to the appropriate development environment to write code, as shown in the following figure:
Through the red Way.
First step:
Create a Java project and create a Python project.
The following Java projects generate:. project files and. classpath files
The main contents of the document are as follows:
<?xmlversion= "1.0" encoding= "UTF-8"?>
<projectDescription>
<name>java_project</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
This ignores the contents of the. Classpath,
Because when merging, this file does not need to be modified generally (here are set Lib path,. class file generation path, source code path, etc.). Open it, see for yourself, very simple.
Then there is a file under the. Settings directory: Org.eclipse.core.resources.prefs
The contents are as follows:
#Mon Oct 11:56:40 CST 2012
Eclipse.preferences.version=1
Org.eclipse.jdt.core.compiler.codegen.inlinejsrbytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetplatform=1.6
Org.eclipse.jdt.core.compiler.codegen.unusedlocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.6
Org.eclipse.jdt.core.compiler.debug.linenumber=generate
Org.eclipse.jdt.core.compiler.debug.localvariable=generate
Org.eclipse.jdt.core.compiler.debug.sourcefile=generate
Org.eclipse.jdt.core.compiler.problem.assertidentifier=error
Org.eclipse.jdt.core.compiler.problem.enumidentifier=error
org.eclipse.jdt.core.compiler.source=1.6
Two files are generated under the Python project:. Project and. Pydevproject
The main contents of the. project file are as follows:
<?xmlversion= "1.0" encoding= "UTF-8"?>
<projectDescription>
<name>py_project</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.python.pydev.PyDevBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.python.pydev.pythonNature</nature>
</natures>
</projectDescription>
The main contents of the. Pydevproject document are as follows:
<?xml version= "1.0" encoding= "UTF-8" standalone= "no"?>
<?eclipse-pydev version= "1.0"?>
<pydev_project>
<pydev_pathproperty name= "Org.python.pydev.PROJECT_SOURCE_PATH" >
<path>/py_project</path>
</pydev_pathproperty>
<pydev_property name= "Org.python.pydev.PYTHON_PROJECT_VERSION" >python 2.7</pydev_property>
<pydev_property name= "Org.python.pydev.PYTHON_PROJECT_INTERPRETER" >Default</pydev_property>
</pydev_project>
Then there is a file under the. Settings directory: Org.eclipse.core.resources.prefs
#Mon Oct 11:56:40 CST 2012
Eclipse.preferences.version=1
Encoding/<project>=utf-8
The second step is to set up and process the files under two items (the same file is merged and the same files are added)
Here's an example of merging a Python project into Java.
So the contents of the Org.eclipse.core.resources.prefs merger are as follows:
#Mon Oct 11:56:40 CST 2012
Eclipse.preferences.version=1
Org.eclipse.jdt.core.compiler.codegen.inlinejsrbytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetplatform=1.6
Org.eclipse.jdt.core.compiler.codegen.unusedlocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.6
Org.eclipse.jdt.core.compiler.debug.linenumber=generate
Org.eclipse.jdt.core.compiler.debug.localvariable=generate
Org.eclipse.jdt.core.compiler.debug.sourcefile=generate
Org.eclipse.jdt.core.compiler.problem.assertidentifier=error
Org.eclipse.jdt.core.compiler.problem.enumidentifier=error
org.eclipse.jdt.core.compiler.source=1.6
Encoding/<project>=utf-8
The following merge contents of the. project file are as follows:
<?xmlversion= "1.0" encoding= "UTF-8"?>
<projectDescription>
<name>java_project</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.python.pydev.PyDevBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.python.pydev.pythonNature</nature>
</natures>
</projectDescription>
Copy the. Pydevproject to the same sibling directory as the. project file.
Here you need to note:
. <name> values in the project file
<path> value in the. pydevproject file
These two values are related to the project name.
Upon completion of the above operation, the same project is completed to switch multiple language development environments.