问题
I created a new "dynamic web project" in Eclipse, installed Bower
globally and then locally in the root directory of my project then hit the command bower install jquery
. It created a bower_components
folder in my project and added the jquery folder perfectly.
Here is the structure created:

I then created a new index.html
file and tried to reference that jquery
file installed with Bower
[I didn't modify any build path or anything, I actually am new to Eclipse]. The reference code is:
<head>
<script src="bower_components/jquery/src/jquery.js" type="text/javascript"></script>
</head>
When I ran that page; looking through the developer tools I kept getting the error:
GET http://localhost:8080/PolymerTrials/bower_components/jquery/src/jquery.js 404 (Not Found)
When I copy the URL in the browesr and hit enter I get:

I tried to manually add a new file named jquery.js
in my directory and copy-pasted the jquery code inside and it managed to load it correctly. But any file I add with Bower
and even though I make sure the referenced path is correct is never loaded. Again, I'm actually new to Eclipse and Bower and all this stuff, so I hope you can help. I feel that it's somehow not being included in the build. Any help is appreciated. Thanks!
回答1:
Looks like your files are not deployed by eclipse.
To fix this go to the "deployment assembly" page in project properties dialog. There you can see list of local resources which will be deployed by eclipse and their destinations. If you add your "bower_components" folder there and set its deploy path to "/bower" then you will be able to reference your jQuery by path "bower/jquery/src/jquery.js"
来源:https://stackoverflow.com/questions/25564364/cant-get-files-installed-with-bower-to-work-in-eclipse