Forums Register Login

Maven Error - Package does not exist, Symbols not recognised

+Pie Number of slices to send: Send

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.
+Pie Number of slices to send: Send

Try to install the jar file with the version that you have mentioned in your POM dependency.
I think these two are mismatching.
+Pie Number of slices to send: Send

Kousik - that did not work unfortunately.

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

Thanks,
Praneet
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send

Have managed to install servlet-api.jar successfully.

Its struts.jar that is giving the problem.


Thanks,
Praneet
+Pie Number of slices to send: Send
Give the pom.xml code and full error trace.
+Pie Number of slices to send: Send
 

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?
+Pie Number of slices to send: Send

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
+Pie Number of slices to send: Send
Remove the last struts plugin:

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

Then run again.
+Pie Number of slices to send: Send

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
+Pie Number of slices to send: Send

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
+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send

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
+Pie Number of slices to send: Send

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
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send

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
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
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?

+Pie Number of slices to send: Send
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 promise I will be the best, most loyal friend ever! All for this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 17735 times.
Similar Threads
Learning Struts 2
Failed to execute goal org.apache.maven.plugins:maven-install-plugin:2.3:install
Building Archetypes
Error Compiling Maven Project
How to change jetty binding port number in maven.
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 05:18:06.