score:1
the src
directory is the default directory where eclipse stores the source code, while in maven is src/main/java
. better check if the .classpath
file has not been corrupted or externally modified. it should contain something like this:
<classpathentry kind="src" output="target/classes" path="src/main/java">
score:0
the code line
package main.java.helloworld;
in the helloworld project results in this package hierarchy:
main
`-+ java
`-+ helloworld
is that really what you mean?
in a maven project, you have this directory structure:
src
`-+ main
| `-+ java
| | `-+ <here your packages and classes>
| '-+ resources
|
'-+ test
| `-+ java
| | `-+ <here your test packages and classes>
| '-+ resources
src/main/java
(production code) and src/test/java
(tests only) are the root of your package hierarchy. if you create the nested packages com.enterprise
within test/java
and create a class test
within enterprise
, then you have to insert this package declaration in test.java
:
package com.enterprise;
take a look at your directory and package structure in the helloworld project.
Source: stackoverflow.com
Related Query
- Eclipse maven project package disorder
- Maven java project in eclipse doesn't see classes in same package
- Multi module maven project is not showing in package structure but as folder structure in eclipse
- maven project in eclipse keeps normal package structure
- How to remove default package in maven project in eclipse
- Convert Existing Eclipse Project to Maven Project
- What causes imported Maven project in Eclipse to use Java 1.5 instead of Java 1.6 by default and how can I ensure it doesn't?
- Importing Maven project into Eclipse
- What is the difference between the Eclipse Package Explorer and the Eclipse Project Explorer?
- Missing Maven dependencies in Eclipse project
- Importing a Maven project into Eclipse from Git
- "Unable to find main class" with Maven on spring-boot project in Eclipse
- Create a Maven project in Eclipse complains "Could not resolve archetype"
- How to create a child package inside a package in eclipse project explorer
- How to run a Maven Project In Tomcat From Eclipse
- Cannot create Maven Project in eclipse
- Maven root pom.xml marked as red when importing existing project into eclipse
- Java Dynamic Web project with Maven and Eclipse
- Maven project not being treated as Java in Eclipse
- Maven does not add classpath to Eclipse project
- Automatically generate .factorypath on project import when using Maven project in Eclipse IDE
- Restore maven plugin for a project on eclipse
- Maven clean + build causes project in Eclipse to show errors until clean in Eclipse
- Eclipse building workspace hangs after importing existing maven project because of JavaScript validation
- Import Maven multi-module project into Eclipse
- Eclipse - How to "Change package declaration to ...." across an entire project
- Error importing Maven Android Android project to Eclipse with ADT 20
- How to create Jar file from Maven project in eclipse
- Why Maven changes Eclipse project preferences?
- Eclipse error setting up Maven project for class exercise: Check $M2_HOME environment variable and mvn script match
More Query from same tag
- Cassandra Setup and Use In Eclipse
- Create Eclipse Java Gradle Project
- Django Eclipse: How to setup settings module in eclipse (trying to use django shell)?
- Code Composer Studio (CCS), importing existing project fails: "Compiler definition not available"
- Easy way to switch a back and forth between a real and mock data service for a Flex 4 application?
- code completion and factory pattern in eclipse pdt
- Adding Richfaces to Maven based project
- What will happen if a process run by eclipse is terminated while the process is doing IO (writing)?
- Indigo Maven Project Builder
- Read server response from SWT Browser
- How to make Maven 3.2.5 understand Java 6 project on a machine using Java 7
- How to subscribe to a MQTT topic and print received messages on Eclipse (Java)
- Eclipse JavaEE (Maven)project WAS 7 migration to IntelliJ
- Eclipse Reads from a different class(file)
- Android : import libraries Like PhotoView
- How to externalize strings to multiple files in Eclipse
- Eclipse hangs at the Android SDK Content Loader
- Google maps cordova geolocation api not working
- Warning while importing JEdit from SVN
- Custom Framework for Writing a Test that Reads a CSV File into a HashMap
- How to view the number of written lines in Eclipse
- Incorporating Derby into eclipse projects?
- Debugging's step into won't work on own code: MyClass$Proxy$_$$_WeldClientProxy.myMethod() line: not available
- Application will not run on Tomcat Server within Eclipse
- Initializing multidimensial array with unknown size array elements gives error
- Build Failed, Missing Key Attribute (Android SDK)
- Handling the export in eclipse thru a plugin
- Refactoring a function definition
- Can I use Uri.Builder from Android SDK in Google App Engine (Java Project)
- Showing markers programmatically