maven - IDEA: how to move Java class across modules -
Running class in the Maven module is a real pain. For two reasons:
- You need to update Maven Dump;
- Your import breaks.
I remediate them in two ways:
Convenient (and not of this) and does not look like a deification in 2015. Is there any way to move the Java class with fewer hassles in the Maven module?
I IntelliJ , And both steps can be done automatically by the IDE in the reverse order.
- Fix the import :
Just drag and drop the orbit from the source of the destination in another pavilion module, and you "move "Option window will get
make sure is in the package and target destination directory on a valid source route ( refactor ) Click).
Wherever the class is used, it should be imported. -
is used to.
Go to the class in a module, which uses the class, but does not have the property Maven dependency, find the name of the class name, which is marked red
Enter alt to pop up the list of fixes and select the last option: Add Mayen dependency ... And select the Maven module moved to the class.
Alternatively you can update pom.xml manually.
Finally, build the complete Maven.
Comments
Post a Comment