0

I cloned the sms-backup-plus repository. This is the repository folder structure by eclipse.

eclipse-folderstructure

But the package name in the project is com.zegoggles.smssync;. So i got error declared package does not match the expected package. How i avoid main/java append in package name.

PS: Android studio works correctly

Update: Production code on main/java/com/zegoggles/smssync and test code on test/java/com/zegoggles/smssync. So i can't rename package name in source files.

Nest
  • 341
  • 4
  • 23

4 Answers4

1

This issue is happening, as your eclipse is not recognizing maven project. Do the following

  • Open command prompt and navigate to your workspace location.
  • Execute command mvn eclipse:eclipse. Make sure that your MAVEN_HOME is configured in environment variables before executing this command.
Dinal
  • 661
  • 4
  • 9
0

THe package name and the directory structure are expected to be the same. Just do a refactor->rename on the packages and take off the main.java

Gabe Sechan
  • 90,003
  • 9
  • 87
  • 127
  • Folder structure is main/java/com/zegoggles/smssync. i update my question – Nest Jun 09 '14 at 08:50
  • That's a bad way of structuring your repository. You should be branching from the root, not just the source code- otherwise you can't test changes to assets or manifest files, because they're shared. Your method will not work with Eclipse. – Gabe Sechan Jun 09 '14 at 08:54
0

You can change the base source directory for the project by opening the Properties for the project, go to Java Build Path and select the Source tab. Change src to be src/main.

greg-449
  • 109,219
  • 232
  • 102
  • 145
0
  1. Select your root package (main.java.com.zegoggles.smssync) in your case
  2. Refactor -> Rename using Alt+Shift+R
  3. Replace the existing package name to com.zegoggles.smssync
  4. Select "Update References" & "Rename Subpackages" checkboxes below.
  5. Project -> Clean from Eclipse
  • If i do files inside the "main/java/com/zegoggles/smssync" and "test/java/com/zegoggles/smssync" will be treated as same – Nest Jun 09 '14 at 08:59