You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by jiangshachina <ji...@gmail.com> on 2006/11/08 03:10:07 UTC

Java Source and Resource

Hello,
With Maven standard directory structure, resources relative to Java source
codes are located at src/resources.
Now I'm using Hibernate. Generally, a Hibernate xml file directly adheres to
its domain Java class.
For example,
src
  |--java
      |--myapp
          |--demo
              |--model
                  |--hibernate
                      |--Dog.java
                      |--Dog.hbm.xml
But when run "mvn compile", Maven would miss the xml file, non-Java source
file.
Maven recommends following structure,
src
  |--java
      |--myapp
          |--demo
              |--model
                  |--hibernate
                      |--Dog.java
  |--resources
      |--myapp
          |--demo
              |--model
                  |--hibernate
                      |--Dog.hbm.xml
Some developers may not like the approach.
Because a package name may be long, then we have to create a long directory
structure under src/resources manually.
Is there a better way?
Thanks!

a cup of Java, cheers!
Sha Jiang
-- 
View this message in context: http://www.nabble.com/Java-Source-and-Resource-tf2592856s177.html#a7231544
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Java Source and Resource

Posted by jiangshachina <ji...@gmail.com>.
Hi,
Now, I use
<resource>
	<directory>src/main/java</directory>
	<excludes>
		<exclude>**/*.java</exclude>
	</excludes>
</resource>
I make Mavne to regard src/main/java as resources dir, too.
But have to exclude Java source files.

a cup of Java, cheers!
Sha Jiang


Wendy Smoak-3 wrote:
> 
> On 11/7/06, jiangshachina <ji...@gmail.com> wrote:
>> With Maven standard directory structure, resources relative to Java
>> source
>> codes are located at src/resources.
>> Now I'm using Hibernate. Generally, a Hibernate xml file directly adheres
>> to
>> its domain Java class.
> ...
>> Some developers may not like the approach.
>> Because a package name may be long, then we have to create a long
>> directory
>> structure under src/resources manually.
>> Is there a better way?
> 
> You can put resources in with the Java classes if you prefer; you just
> have to add more configuration to pom.xml to tell Maven about it.
> 
> See <resources><resource> in the model:
>    http://maven.apache.org/ref/2.0.4/maven-model/maven.html
> 
> Also note that if you have any resources in the default location of
> src/main/resources, you'll need to specify that in addition to
> src/main/java.  (Once you specify <resources>, you lose the default.)
> 
> -- 
> Wendy
> 
> -- 
> Wendy
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Java-Source-and-Resource-tf2592856s177.html#a7232206
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Java Source and Resource

Posted by Wendy Smoak <ws...@gmail.com>.
On 11/7/06, jiangshachina <ji...@gmail.com> wrote:
> With Maven standard directory structure, resources relative to Java source
> codes are located at src/resources.
> Now I'm using Hibernate. Generally, a Hibernate xml file directly adheres to
> its domain Java class.
...
> Some developers may not like the approach.
> Because a package name may be long, then we have to create a long directory
> structure under src/resources manually.
> Is there a better way?

You can put resources in with the Java classes if you prefer; you just
have to add more configuration to pom.xml to tell Maven about it.

See <resources><resource> in the model:
   http://maven.apache.org/ref/2.0.4/maven-model/maven.html

Also note that if you have any resources in the default location of
src/main/resources, you'll need to specify that in addition to
src/main/java.  (Once you specify <resources>, you lose the default.)

-- 
Wendy

-- 
Wendy

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org