File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Ant, Maven and Other Build Tools and the fly likes Maven Error - Package does not exist, Symbols not recognised Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Maven Error - Package does not exist, Symbols not recognised" Watch "Maven Error - Package does not exist, Symbols not recognised" New topic
Author

Maven Error - Package does not exist, Symbols not recognised

Praneet Mirchandani
Ranch Hand

Joined: Dec 16, 2009
Posts: 46

Hi,

I am trying to build a Struts Web Application using Maven. I am getting the following errors when I run mvn compile:

1. package org.apache.struts.action does not exist
2. package org.apache.struts.util does not exist

Also getting the following unrecognised symbol errors:

1. ActionMapping, ActionForm, ActionForward, ActionErrors

2. HttpSevletRequest, HttpServletResponse

3. DynaActionForm

I tried installing the struts.jar file in the local maven repository using the command:

mvn install:install-file -DgroupId=struts -DartifactId=struts -Dversion=1.0 -Dpackaging=jar -Dfile= Path to file.

It gives the following error:
The plugin 'org.apache.maven.plugins:maven-D-plugin' does not exist or no valid version could be found.

Please help.

Thanks,
Praneet.


Thanks,
Praneet
Kousik Majumder
Ranch Hand

Joined: Sep 30, 2007
Posts: 229

Try to install the jar file with the version that you have mentioned in your POM dependency.
I think these two are mismatching.


Thanks in Advance,
Kousik
Praneet Mirchandani
Ranch Hand

Joined: Dec 16, 2009
Posts: 46

Kousik - that did not work unfortunately.

Do you know what is the latest version of the struts jar file?

Thanks,
Praneet
Kousik Majumder
Ranch Hand

Joined: Sep 30, 2007
Posts: 229
I think that hardly matter. What you have used in your project that only matters.
You also need to install servlet API jar. Because your error list also include that one.
Praneet Mirchandani
Ranch Hand

Joined: Dec 16, 2009
Posts: 46

Have managed to install servlet-api.jar successfully.

Its struts.jar that is giving the problem.


Thanks,
Praneet
Kousik Majumder
Ranch Hand

Joined: Sep 30, 2007
Posts: 229
Give the pom.xml code and full error trace.
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10046
    
163

I tried installing the struts.jar file in the local maven repository using the command:


It already available in the Maven repo. What exact errors do you get? And what does your pom.xml look like?

[My Blog] [JavaRanch Journal]
Praneet Mirchandani
Ranch Hand

Joined: Dec 16, 2009
Posts: 46

Hi,

I downloaded the struts jar from the maven repository and pasted it in my local maven repository.

Pasted the following at the path - D:\Documents and Settings\praneet.mirchandani\.m2\repository\struts\struts\1.0.2

struts-1.0.2.jar, struts-1.0.2.jar.sha1, struts-1.0.2.pom, struts-1.0.2.pom.sha1.

Then I ran mvn compile. This is the error log I got:


[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] The plugin descriptor for the plugin Plugin [struts:struts] was not found
. Please verify that the plugin JAR D:\Documents and Settings\praneet.mirchandan
i\.m2\repository\struts\struts\1.0.2\struts-1.0.2.jar is intact.
[INFO] ------------------------------------------------------------------------
[INFO] Trace
java.lang.IllegalStateException: The plugin descriptor for the plugin Plugin [st
ruts:struts] was not found. Please verify that the plugin JAR D:\Documents and S
ettings\praneet.mirchandani\.m2\repository\struts\struts\1.0.2\struts-1.0.2.jar
is intact.
at org.apache.maven.plugin.DefaultPluginManager.addPlugin(DefaultPluginM
anager.java:360)
at org.apache.maven.plugin.DefaultPluginManager.verifyVersionedPlugin(De
faultPluginManager.java:224)
at org.apache.maven.plugin.DefaultPluginManager.verifyPlugin(DefaultPlug
inManager.java:184)
at org.apache.maven.plugin.DefaultPluginManager.loadPluginDescriptor(Def
aultPluginManager.java:1642)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.verifyPlugin(Defa
ultLifecycleExecutor.java:1540)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.bindPluginToLifec
ycle(DefaultLifecycleExecutor.java:1503)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.constructLifecycl
eMappings(DefaultLifecycleExecutor.java:1282)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(Defau
ltLifecycleExecutor.java:534)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHan
dleFailures(DefaultLifecycleExecutor.java:387)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegmen
ts(DefaultLifecycleExecutor.java:348)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLi
fecycleExecutor.java:180)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:6
0)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)

at org.codehaus.classworlds.Launcher.main(Launcher.java:375)


This is the pom.xml file:


Thanks,
Praneet
Kousik Majumder
Ranch Hand

Joined: Sep 30, 2007
Posts: 229
Remove the last struts plugin:

<plugin>
<groupId>struts</groupId>
<artifactId>struts</artifactId>
<version>1.0.2</version>
</plugin>

Then run again.
Praneet Mirchandani
Ranch Hand

Joined: Dec 16, 2009
Posts: 46

Hi Kousik,

Tried what you suggested. Now it is throwing me some more errors when I run mvn compile:

package org.apache.struts.action does not exist

package org.apache.struts.util does not exist

Unrecognised Symbols

ActionMapping, ActionForm
ActionForward, ActionErrors
DynaActionForm, DispatchAction

Thanks,
Praneet
Praneet Mirchandani
Ranch Hand

Joined: Dec 16, 2009
Posts: 46

Hi,

I need to include a jar file I have made in order to build the project.

I think I would need to mention that in my pom.xml, but I dont know how?

I dont think it can be put in the dependency tag or the plug in tag. So where do I put it?

Thanks,
Praneet
Kousik Majumder
Ranch Hand

Joined: Sep 30, 2007
Posts: 229
I think you have installed in wrong way.
Run the following command and install again.
I have only changed the groupid.

mvn install:install-file -DgroupId=org.apache.struts -DartifactId=struts -Dversion=1.0 -Dpackaging=jar -Dfile= Path to file
Praneet Mirchandani
Ranch Hand

Joined: Dec 16, 2009
Posts: 46

Hi,

I tried that. It throws the following error:

The plugin 'org.apache.maven.plugins:maven-D-plugin' does not exist or no valid version could be found.


Thanks,
Praneet
Kousik Majumder
Ranch Hand

Joined: Sep 30, 2007
Posts: 229

Sorry . I make the mistake now. make the version 2.0.6 in the command line prompt that I had written.

mvn install:install-file -DgroupId=org.apache.struts -DartifactId=struts -Dversion=2.0.6 -Dpackaging=jar -Dfile= Path to file
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Struts 2.0.6?!

To the original poster: please show the *exact* command you're typing, and put it inside code tags, so we can see where any spaces are. So far it just looksl ike you're not putting quotes around a path that has spaces in it, which will cause the install to fail.

You can also just *look* in the repository to see if it's there, and obviously the dependency needs to be in your POM.

To summarize:
- Post the *exact* command you're using to install, in code tags
- Check to see if it's already in the repository
- Post the POM dependency you're using.
Praneet Mirchandani
Ranch Hand

Joined: Dec 16, 2009
Posts: 46

Sorry. Noted for next time.

I had to include a certain jar as a dependency. So I pasted it in the local repository and then ran the command below.



It gave the following error:
The plugin 'org.apache.maven.plugins:maven-D-plugin' does not exist or no valid version could be found.

Tried searching a lot for this error, but could not figure out.

Thanks,
Praneet
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Like I said, you're not quoting a path with a space in it: the computer has no way of knowing that space isn't delimiting commands. I'd also remove the space after the "-Dfile= ".

And *don't* put it in the repository manually--put it somewhere easy (like c:\), then you don't have to worry about spaces at all.
Praneet Mirchandani
Ranch Hand

Joined: Dec 16, 2009
Posts: 46
Hi

I managed to install the external jar. Thanks David.

But when I ran mvn compile after that, it still threw me errors saying it cannot recognise certain packages which were in the newly installed jar. Any idea why this happened?

David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

You did it wrong? Your POM dependency is wrong? The jar doesn't contain the classes you think it does?

Without knowing any details, it's impossible to help.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Maven Error - Package does not exist, Symbols not recognised